1
Fork 0
migration-helper/tests/number.test.ts

17 lines
430 B
TypeScript
Raw Normal View History

2022-03-03 13:40:38 +00:00
import test from 'ava';
import {migrate, Migration} from '../source/migration-helper.js';
test('migrate<number>', async (t) => {
2023-05-08 10:23:28 +00:00
const migrations: Array<Migration<number, string, string>> = [
2022-03-03 13:40:38 +00:00
{
version: 5,
migrate: async (data: string) => `${data} migrated`,
},
];
const data = 'data';
t.is(await migrate(data, 4, migrations), 'data migrated');
t.is(await migrate(data, 6, migrations), data);
});