-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathlogout.test.ts
34 lines (25 loc) · 958 Bytes
/
logout.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { describe, afterEach, beforeAll, it, expect } from 'vitest';
import Command from '../../src/commands/logout.js';
import configStore from '../../src/lib/configstore.js';
import { runCommand, type OclifOutput } from '../helpers/oclif.js';
describe('rdme logout', () => {
let run: (args?: string[]) => OclifOutput;
beforeAll(() => {
run = runCommand(Command);
});
afterEach(() => {
configStore.clear();
});
it("should report the user as logged out if they aren't logged in", () => {
configStore.delete('email');
configStore.delete('project');
return expect(run()).resolves.toMatchSnapshot();
});
it('should log the user out', async () => {
configStore.set('project', 'subdomain');
await expect(run()).resolves.toMatchSnapshot();
expect(configStore.get('email')).toBeUndefined();
expect(configStore.get('project')).toBeUndefined();
});
});