From a30d1f07fc0e1bb60446400d036f9ac16eba9606 Mon Sep 17 00:00:00 2001 From: Jeff Avallone Date: Sun, 11 Feb 2018 09:45:46 -0500 Subject: [PATCH] Mocking environment for PageTemplate tests --- src/components/PageTemplate.test.js | 13 +++++++++++++ .../__snapshots__/PageTemplate.test.js.snap | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/components/PageTemplate.test.js b/src/components/PageTemplate.test.js index 8b272de..abdb7b7 100644 --- a/src/components/PageTemplate.test.js +++ b/src/components/PageTemplate.test.js @@ -3,6 +3,19 @@ import renderer from 'react-test-renderer'; import PageTemplate from './PageTemplate'; +const env = { ...process.env }; + +afterEach(() => { + process.env = env; +}); + +beforeEach(() => { + process.env = { + ...process.env, + BANNER: 'testing' + }; +}); + test('PageTemplate rendering', () => { const component = renderer.create( diff --git a/src/components/__snapshots__/PageTemplate.test.js.snap b/src/components/__snapshots__/PageTemplate.test.js.snap index af2faba..6162fc8 100644 --- a/src/components/__snapshots__/PageTemplate.test.js.snap +++ b/src/components/__snapshots__/PageTemplate.test.js.snap @@ -24,7 +24,7 @@ exports[`PageTemplate rendering 1`] = `

@@ -103,7 +103,7 @@ exports[`PageTemplate rendering with title 1`] = `