Skip to content

Commit

Permalink
only mock return values once
Browse files Browse the repository at this point in the history
  • Loading branch information
yannbf committed Jul 14, 2023
1 parent 4c0b949 commit 7ec911f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/util/getCliOptions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ describe('getCliOptions', () => {
const customConfig = { configDir: 'custom', indexJson: true };
jest
.spyOn(cliHelper, 'getParsedCliOptions')
.mockReturnValue({ options: customConfig, extraArgs: [] });
.mockReturnValueOnce({ options: customConfig, extraArgs: [] });
const opts = getCliOptions();
expect(opts.runnerOptions).toMatchObject(customConfig);
});

it('returns extra args if passed', () => {
const extraArgs = ['TestName', 'AnotherTestName'];
jest.spyOn(cliHelper, 'getParsedCliOptions').mockReturnValue({ options: {}, extraArgs });
jest.spyOn(cliHelper, 'getParsedCliOptions').mockReturnValueOnce({ options: {}, extraArgs });
const opts = getCliOptions();
expect(opts.jestOptions).toEqual(extraArgs);
});
Expand Down

0 comments on commit 7ec911f

Please sign in to comment.