Skip to content

Instantly share code, notes, and snippets.

@rjpkuyper
Last active February 17, 2023 06:11
Show Gist options
  • Save rjpkuyper/c824b276f733260d5b79f70c56d391c7 to your computer and use it in GitHub Desktop.
Save rjpkuyper/c824b276f733260d5b79f70c56d391c7 to your computer and use it in GitHub Desktop.
Test the env vars
import { createUrl, Paths } from './get-env-vars'
describe("GetEnvVars", () => {
const OLD_ENV = process.env;
beforeEach(() => {
process.env = { ...OLD_ENV };
delete process.env.NODE_ENV;
});
afterEach(() => {
process.env = OLD_ENV;
});
test('should create a new url', () => {
process.env.BASE_URL = 'https://example.com';
expect(createUrl(Paths.PRODUCTS)).toEqual(`${process.env.BASR_URL}/${Paths.PRODUCTS}`);
});
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment