Files
edx-platform/lms/static/js/spec/student_account/emailoptin_spec.js
Jayram 5a9e12dd96 [ADD] user account registration endpoint for api-docs
Added alias for /user_api endpoints

FIX quality violations

IMPROVED urls_common for readability

Removed redundant URL entry from urls_common file
2021-01-15 03:59:16 +00:00

28 lines
1.0 KiB
JavaScript

define(['edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers', 'js/student_account/emailoptin'],
function(AjaxHelpers, EmailOptInInterface) {
'use strict';
describe('EmailOptInInterface', function() {
var COURSE_KEY = 'edX/DemoX/Fall',
EMAIL_OPT_IN = 'True',
EMAIL_OPT_IN_URL = '/api/user/v1/preferences/email_opt_in/';
it('Opts in for organization emails', function() {
// Spy on Ajax requests
var requests = AjaxHelpers.requests(this);
// Attempt to enroll the user
EmailOptInInterface.setPreference(COURSE_KEY, EMAIL_OPT_IN);
// Expect that the correct request was made to the server
AjaxHelpers.expectRequest(
requests, 'POST', EMAIL_OPT_IN_URL, 'course_id=edX%2FDemoX%2FFall&email_opt_in=True'
);
// Simulate a successful response from the server
AjaxHelpers.respondWithJson(requests, {});
});
});
}
);