mirror of
https://github.com/smogon/sprites.git
synced 2026-04-08 18:26:03 -05:00
26 lines
765 B
TypeScript
26 lines
765 B
TypeScript
|
|
import * as pathlib from './path.js';
|
|
import * as script from './script.js';
|
|
|
|
test('runOnFile', () => {
|
|
const scr = new script.Script('({name: "25"})');
|
|
const src = pathlib.path('/foo/bar/pikachu.png');
|
|
const dst = scr.runOnFile(src);
|
|
expect(dst).toEqual(pathlib.path('25.png'));
|
|
});
|
|
|
|
test('run identity', () => {
|
|
const aq = new script.ActionQueue();
|
|
const scr = new script.Script(`
|
|
for (const p of list(".")) {
|
|
copy(p, p);
|
|
}
|
|
`);
|
|
scr.run("testsrc", "testdst", aq);
|
|
expect(aq.describe()).toEqual(expect.arrayContaining([
|
|
{src: pathlib.path('testsrc/32.png'), dst: pathlib.path("testdst/32.png")},
|
|
{src: pathlib.path('testsrc/192-g-vsmogon.png'), dst: pathlib.path("testdst/192-g-vsmogon.png")},
|
|
]));
|
|
});
|
|
|