UNPKG

@toptal/davinci-qa

Version:
36 lines (29 loc) 875 B
import { jest } from '@jest/globals' import toJestCLIArguments from './to-jest-cli-arguments.js' import argsToCLIRules from './jest-args-to-cli-converters.js' const EXAMPLE_REPORTER = 'some-jest-reporter' const ARGS_TO_CLI_RESULT = [EXAMPLE_REPORTER] const reportersMock = jest.spyOn(argsToCLIRules, 'reporters') describe('toJestCLIArguments', () => { it('converts boolean strings to booleans correctly', async () => { expect( await toJestCLIArguments({ cache: 'false', ci: 'true', }) ).toEqual({ cache: false, ci: true, }) }) it('converts some rules by using args-to-cli rules', async () => { reportersMock.mockReturnValueOnce(ARGS_TO_CLI_RESULT) expect( await toJestCLIArguments({ reporters: EXAMPLE_REPORTER, }) ).toEqual({ reporters: ARGS_TO_CLI_RESULT, }) }) })