-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathserverside-rendering.test.js
48 lines (44 loc) · 1.97 KB
/
serverside-rendering.test.js
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import Nightmare from 'nightmare';
import { testPathServersideRender } from '__tests__/end-to-end/e2e-utilities';
import { NIGHTMARE_CONFIG } from '__tests__/end-to-end/e2e-constants';
import { HOST } from './e2e-gazelle-constants';
describe('The Gazelle server side rendering', () => {
let nightmare = null;
beforeEach(() => {
nightmare = new Nightmare(NIGHTMARE_CONFIG);
});
afterEach(() => {
// Kill the nightmare instance, this won't make a difference if everything worked as expected
// but if we don't have it when something doesn't go as unexpected it can make jest hang
// and not terminate
nightmare.halt();
});
it('renders front page correctly', () =>
testPathServersideRender(nightmare, HOST, ''));
it('renders team page correctly', () =>
testPathServersideRender(nightmare, HOST, '/team'));
it('renders archive page correctly', () =>
testPathServersideRender(nightmare, HOST, '/archives'));
it('renders about page correctly', () =>
testPathServersideRender(nightmare, HOST, '/about'));
it('renders code of ethics page correctly', () =>
testPathServersideRender(nightmare, HOST, '/ethics'));
it('renders category page correctly', () =>
testPathServersideRender(nightmare, HOST, '/category/news'));
it('renders non-default issue page correctly', () =>
testPathServersideRender(nightmare, HOST, '/issue/100'));
it('renders search page correctly', () =>
testPathServersideRender(nightmare, HOST, '/search?q=title-1'));
it('renders article page correctly', () =>
testPathServersideRender(nightmare, HOST, '/issue/1/news/slug-1'));
it('renders staff member page correctly', () =>
testPathServersideRender(nightmare, HOST, '/staff-member/staff1'));
// This should definitely return a 404 but it isn't implemented right now so we'll make it a todo
it('renders not found page correctly', () =>
testPathServersideRender(
nightmare,
HOST,
'/this/path/should/not/exist',
200,
));
});