Skip to content

Commit 372b698

Browse files
committed
update test
1 parent 406b8b1 commit 372b698

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

packages/cli/test/migrate.test.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,17 @@ describe('CLI migrate commands test', () => {
4646
// find the migration record "timestamp_init"
4747
const migrationRecords = fs.readdirSync(path.join(workDir, 'zenstack/migrations'));
4848
const migration = migrationRecords.find((f) => f.endsWith('_init'));
49-
expect(migration).toBeDefined();
49+
50+
// force a migration failure
51+
fs.writeFileSync(path.join(workDir, 'zenstack/migrations', migration!, 'migration.sql'), 'invalid content');
52+
53+
// redeploy the migration, which will fail
54+
fs.rmSync(path.join(workDir, 'zenstack/dev.db'), { force: true });
55+
try {
56+
runCli('migrate deploy', workDir);
57+
} catch {
58+
// noop
59+
}
5060

5161
// --rolled-back
5262
runCli(`migrate resolve --rolled-back ${migration}`, workDir);

0 commit comments

Comments
 (0)