Skip to content

Commit

Permalink
Apply comment from code review to simplify test, thanks @greyseer256
Browse files Browse the repository at this point in the history
  • Loading branch information
kriswest committed Feb 21, 2022
1 parent 3f0b876 commit 7a10fdd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions test/Methods.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ expect.extend({
},
});

beforeEach(() => {
jest.resetAllMocks();
});

describe('test ES6 module', () => {
describe('without `window.fdc3` global', () => {
test('open should reject', async () => {
Expand Down Expand Up @@ -203,7 +207,7 @@ describe('test ES6 module', () => {
test('getSystemChannels should delegate to window.fdc3.getUserChannels', async () => {
await getSystemChannels();

expect(window.fdc3.getUserChannels).toHaveBeenCalledTimes(2); //was already called in previous test, hence this should be the second call to getUserChannels
expect(window.fdc3.getUserChannels).toHaveBeenCalledTimes(1);
expect(window.fdc3.getUserChannels).toHaveBeenCalledWith();
});

Expand All @@ -221,7 +225,7 @@ describe('test ES6 module', () => {

await joinUserChannel(channelId);

expect(window.fdc3.joinUserChannel).toHaveBeenCalledTimes(2);
expect(window.fdc3.joinUserChannel).toHaveBeenCalledTimes(1);
expect(window.fdc3.joinUserChannel).toHaveBeenCalledWith(channelId);
});

Expand Down

0 comments on commit 7a10fdd

Please sign in to comment.