-
Notifications
You must be signed in to change notification settings - Fork 119
/
app-error.test.ts
35 lines (32 loc) · 1.03 KB
/
app-error.test.ts
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
import snapshot from '@smpx/snap-shot-it';
import { getErrorMessage } from '../src/app-error';
describe('app-error', function() {
describe('getErrorMessage', function() {
const tests = [
{ code: 'NoBundles' },
{ code: 'NoSourceMap' },
{ code: 'OneSourceSourceMap', filename: 'foo.min.js' },
{ code: 'UnmappedBytes', totalBytes: 100, unmappedBytes: 70 },
{ code: 'InvalidMappingLine', generatedLine: 60, maxLine: 57 },
{
code: 'InvalidMappingColumn',
generatedLine: 60,
generatedColumn: 81,
maxColumn: 80,
},
{ code: 'CannotSaveFile' },
{ code: 'CannotCreateTempFile' },
{
code: 'CannotOpenTempFile',
error: Buffer.from('The system cannot find the file ?C:\\foo.htm'),
tempFile: 'C:\\foo.htm',
},
{ code: 'UnknownCode' },
];
tests.forEach(function(context) {
it(`should create message for '${context.code}'`, function() {
snapshot(getErrorMessage(context as any));
});
});
});
});