mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-10 04:22:12 +00:00
These changes originally from #6652, but pulled out to be merged separately. `outputBuffer` is a simpler way of asserting tests against the CLI output instead of working directly withe Jest mock function. `output.isTTY` is also now mutable, so that we can write tests for both cases when the output is different based on TTY-ness (for example, see the updated `vc whoami` tests in this PR).
14 lines
421 B
TypeScript
14 lines
421 B
TypeScript
import { client } from '../mocks/client';
|
|
import login from '../../src/commands/login';
|
|
|
|
describe('login', () => {
|
|
it('should not allow the `--token` flag', async () => {
|
|
client.setArgv('login', '--token', 'foo');
|
|
const exitCode = await login(client);
|
|
expect(exitCode).toEqual(2);
|
|
expect(client.outputBuffer).toEqual(
|
|
'Error! `--token` may not be used with the "login" command\n'
|
|
);
|
|
});
|
|
});
|