-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathenv.test.ts
More file actions
26 lines (21 loc) · 679 Bytes
/
env.test.ts
File metadata and controls
26 lines (21 loc) · 679 Bytes
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
import { getEnvironmentVariables } from './env';
describe('env', () => {
describe('getEnvironmentVariables', () => {
let existingProcessEnv: NodeJS.ProcessEnv;
beforeEach(() => {
existingProcessEnv = { ...process.env };
});
afterEach(() => {
Object.keys(existingProcessEnv).forEach((key) => {
process.env[key] = existingProcessEnv[key];
});
});
it('returns only the environment variables from process.env that we use in this tool', () => {
process.env.EDITOR = 'editor';
process.env.EXTRA = 'extra';
expect(getEnvironmentVariables()).toStrictEqual({
EDITOR: 'editor',
});
});
});
});