fix: update logic for unenrollment (#36)
This commit is contained in:
@@ -4,6 +4,7 @@ import * as utils from './utils';
|
||||
|
||||
jest.mock('query-string', () => ({
|
||||
stringifyUrl: jest.fn((url, options) => ({ url, options })),
|
||||
stringify: jest.fn((data) => data),
|
||||
}));
|
||||
jest.mock('@edx/frontend-platform/auth', () => ({
|
||||
getAuthenticatedHttpClient: jest.fn(),
|
||||
@@ -22,8 +23,15 @@ describe('lms service utils', () => {
|
||||
it('forwards arguments to authenticatedHttpClient().post', () => {
|
||||
const post = jest.fn((...args) => ({ post: args }));
|
||||
getAuthenticatedHttpClient.mockReturnValue({ post });
|
||||
const args = ['some', 'args', 'for', 'the', 'test'];
|
||||
expect(utils.post(...args)).toEqual(post(...args));
|
||||
const url = 'some url';
|
||||
const body = {
|
||||
some: 'body',
|
||||
for: 'the',
|
||||
test: 'yay',
|
||||
};
|
||||
const expectedUrl = utils.post(url, body);
|
||||
expect(queryString.stringify).toHaveBeenCalledWith(body);
|
||||
expect(expectedUrl).toEqual(post(url, body));
|
||||
});
|
||||
});
|
||||
describe('stringifyUrl', () => {
|
||||
|
||||
Reference in New Issue
Block a user