mirror of
https://github.com/smogon/sprites.git
synced 2026-04-19 08:17:21 -05:00
deploy: setup ts-jest + basic test
This commit is contained in:
parent
623f8290c4
commit
e33c041f79
3596
pnpm-lock.yaml
3596
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
14
tools/deploy/jest.config.js
Normal file
14
tools/deploy/jest.config.js
Normal 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'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -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": {
|
||||
|
|
|
|||
18
tools/deploy/script.test.ts
Normal file
18
tools/deploy/script.test.ts
Normal 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')}]);
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user