feat: credit banner (#96)

This commit is contained in:
Ben Warzeski
2022-12-19 13:25:02 -05:00
committed by GitHub
parent a21698e96a
commit 166c64a391
52 changed files with 1678 additions and 141 deletions

View File

@@ -16,7 +16,7 @@ jest.mock('./utils', () => {
client: () => ({ delete: deleteFn }),
delete: deleteFn,
get: (...args) => ({ get: args }),
post: (...args) => ({ post: args }),
post: jest.fn((...args) => ({ post: args })),
stringifyUrl: (...args) => ({ stringifyUrl: args }),
};
});
@@ -29,6 +29,9 @@ const isRefundable = 'test-is-refundable';
const moduleKeys = keyStore(api);
describe('lms api methods', () => {
beforeEach(() => {
jest.clearAllMocks();
});
describe('initializeList', () => {
test('calls get with the correct url and user', () => {
const userArg = {
@@ -135,4 +138,17 @@ describe('lms api methods', () => {
});
});
});
describe('credit requests', () => {
describe('createCreditRequest', () => {
const providerId = 'test-provider-id';
const username = 'test-username';
it('posts course ID and username to credit request url', () => {
api.createCreditRequest({ providerId, courseId, username });
expect(utils.post).toHaveBeenCalledWith(
urls.creditRequestUrl(providerId),
{ course_key: courseId, username },
);
});
});
});
});