-
Notifications
You must be signed in to change notification settings - Fork 76
Expand file tree
/
Copy pathhtml_reverse_mapper.spec.ts
More file actions
68 lines (61 loc) · 1.85 KB
/
html_reverse_mapper.spec.ts
File metadata and controls
68 lines (61 loc) · 1.85 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
59
60
61
62
63
64
65
66
67
68
import fs from 'fs';
import {FileExportTypes, FromHDFToHTMLMapper} from '../../../index';
//import {version as hdfConvertersVersion} from '../../../package.json';
describe('HTML Reverse Mapper', () => {
it('Successfully converts RHEL7 HDF into HTML (administrator output type)', () => {
const inputData = [
{
data: fs.readFileSync(
'sample_jsons/caat_reverse_mapper/sample_input_report/red_hat_good.json',
{encoding: 'utf-8'}
),
fileName: 'red_hat_good.json',
fileID: '0'
}
];
const mapper = new FromHDFToHTMLMapper(
inputData,
'Administrator' as FileExportTypes
);
const converted = mapper.toHTML();
const expected = fs.readFileSync(
'sample_jsons/html_reverse_mapper/red_hat_good_html.html',
'utf-8'
);
converted.then((c) => {
expect(c).toEqual(expected);
});
});
it('Successfully combines two HDF inputs into a single output html (manager output type)', () => {
const inputData = [
{
data: fs.readFileSync(
'sample_jsons/caat_reverse_mapper/sample_input_report/triple_overlay_profile_example.json',
{encoding: 'utf-8'}
),
fileName: 'triple_overlay_profile_example.json',
fileID: '0'
},
{
data: fs.readFileSync(
'sample_jsons/caat_reverse_mapper/sample_input_report/red_hat_good.json',
{encoding: 'utf-8'}
),
fileName: 'red_hat_good.json',
fileID: '1'
}
];
const mapper = new FromHDFToHTMLMapper(
inputData,
'Manager' as FileExportTypes
);
const converted = mapper.toHTML();
const expected = fs.readFileSync(
'sample_jsons/html_reverse_mapper/combined_hdf_output_html.html',
'utf-8'
);
converted.then((c) => {
expect(c).toEqual(expected);
});
});
});