deploy: setup ts-jest + basic test

This commit is contained in:
Christopher Monsanto 2020-08-08 03:50:56 -04:00
parent 623f8290c4
commit e33c041f79
4 changed files with 3557 additions and 74 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,14 @@
export default {
preset: 'ts-jest/presets/js-with-ts',
testEnvironment: 'node',
// ts-jest doesn't like esm
moduleNameMapper: {
'^(.*).js$': '$1'
},
globals: {
'ts-jest': {
packageJson: 'package.json'
}
}
};

View File

@ -6,6 +6,9 @@
"debug": "^4.1.1"
},
"devDependencies": {
"@types/jest": "^26.0.9",
"jest": "^26.2.2",
"ts-jest": "^26.1.4",
"typescript": "^3.9.7"
},
"scripts": {

View File

@ -0,0 +1,18 @@
import * as pathlib from './path.js';
import * as script from './script.js';
test('aq', () => {
const aq = new script.ActionQueue();
const src = pathlib.path('/foo/bar/pikachu.png');
const input = pathlib.update(src, {dir: ""});
const scr = new script.Script('({name: "25"})');
const result = scr.runOnFile(input);
const output = pathlib.path(input, result);
const dst = output;
aq.copy(src, dst);
expect(aq.describe()).toEqual([{src: pathlib.path('/foo/bar/pikachu.png'),
dst: pathlib.path('25.png')}]);
});