-
Notifications
You must be signed in to change notification settings - Fork 394
Expand file tree
/
Copy pathrender-html.test.js
More file actions
58 lines (54 loc) · 1.49 KB
/
render-html.test.js
File metadata and controls
58 lines (54 loc) · 1.49 KB
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
49
50
51
52
53
54
55
56
57
58
import renderHTML from './render-html';
jest.mock(
'jsonresume-theme-even',
() => {
return {
render: () => 'hello from theme even',
};
},
{ virtual: true },
);
jest.mock(
'/the/mocked/cwd/some-local-theme',
() => {
return {
render: () => 'hello from the local mocked theme',
};
},
{ virtual: true },
);
describe('renderHTML', () => {
beforeAll(() => {
const localPath = '/the/mocked/cwd/';
process.cwd = jest.fn().mockReturnValue(localPath);
});
const resume = {
basics: {
name: 'test',
label: 'Programmer',
email: 'test4@test.com',
},
};
it('should reject when theme is not availlable', async () => {
await expect(
renderHTML({ resume, themePath: 'unknown' }),
).rejects.toBeTruthy();
});
describe('when theme is availlable', () => {
it('should resolve from cwd when themePath starts with a period', async () => {
expect(
await renderHTML({ resume, themePath: './some-local-theme' }),
).toMatchInlineSnapshot(`"hello from the local mocked theme"`);
});
it('should render html with long theme name', async () => {
expect(
await renderHTML({ resume, themePath: 'jsonresume-theme-even' }),
).toMatchInlineSnapshot(`"hello from theme even"`);
});
it('should render html with short theme name', async () => {
expect(
await renderHTML({ resume, themePath: 'even' }),
).toMatchInlineSnapshot(`"hello from theme even"`);
});
});
});