(t, { otp = {}, ...rest }, fn)
| 4 | |
| 5 | // TODO make this real and not a mock |
| 6 | const setupOtplease = async (t, { otp = {}, ...rest }, fn) => { |
| 7 | const { otplease } = tmock(t, '{LIB}/utils/auth.js', { |
| 8 | '{LIB}/utils/read-user-info.js': { |
| 9 | otp: async () => '1234', |
| 10 | }, |
| 11 | '{LIB}/utils/open-url.js': { |
| 12 | createOpener: () => () => {}, |
| 13 | }, |
| 14 | 'npm-profile': { |
| 15 | webAuthOpener: async (opener) => { |
| 16 | opener() |
| 17 | return { token: '1234' } |
| 18 | }, |
| 19 | }, |
| 20 | }) |
| 21 | return otplease(await setupMockNpm(t, rest).then(({ npm }) => npm), otp, fn) |
| 22 | } |
| 23 | |
| 24 | t.test('returns function results on success', async (t) => { |
| 25 | const result = await setupOtplease(t, {}, () => 'test string') |
no test coverage detected