UNPKG

566 BPlain TextView Raw
1import {strictEqual} from 'assert';
2import {readFileSync} from 'fs';
3
4export const testFilePath = (id: string) => `./test-tmp/${id}.csv`;
5
6export const assertFile = (path: string, expectedContents: string, encoding?: string) => {
7 const actualContents = readFileSync(path, encoding || 'utf8');
8 strictEqual(actualContents, expectedContents);
9};
10
11export 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};