1 | import {strictEqual} from 'assert';
|
2 | import {readFileSync} from 'fs';
|
3 |
|
4 | export const testFilePath = (id: string) => `./test-tmp/${id}.csv`;
|
5 |
|
6 | export const assertFile = (path: string, expectedContents: string, encoding?: string) => {
|
7 | const actualContents = readFileSync(path, encoding || 'utf8');
|
8 | strictEqual(actualContents, expectedContents);
|
9 | };
|
10 |
|
11 | export const assertRejected = (p: Promise<any>, message: string) => {
|
12 | return p.then(
|
13 | () => new Error('Should not have been called'),
|
14 | (e: Error) => { strictEqual(e.message, message); }
|
15 | );
|
16 | };
|