Skip to content

Commit a460646

Browse files
committed
test: update cli tests
1 parent 8e89c88 commit a460646

File tree

4 files changed

+9
-14
lines changed

4 files changed

+9
-14
lines changed

packages/cli/test/check.test.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,12 @@ describe('CLI validate command test', () => {
8383

8484
it('should validate schema with syntax errors', () => {
8585
const modelWithSyntaxError = `
86-
datasource db {
87-
provider = "sqlite"
88-
url = "file:./dev.db"
89-
}
90-
9186
model User {
9287
id String @id @default(cuid())
9388
email String @unique
9489
// Missing closing brace - syntax error
9590
`;
96-
const workDir = createProject(modelWithSyntaxError, false);
91+
const workDir = createProject(modelWithSyntaxError);
9792

9893
// Should throw an error due to syntax error
9994
expect(() => runCli('check', workDir)).toThrow();

packages/cli/test/db.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describe('CLI db commands test', () => {
1313
it('should generate a database with db push', () => {
1414
const workDir = createProject(model);
1515
runCli('db push', workDir);
16-
expect(fs.existsSync(path.join(workDir, 'zenstack/dev.db'))).toBe(true);
16+
expect(fs.existsSync(path.join(workDir, 'zenstack/test.db'))).toBe(true);
1717
});
1818

1919
it('should seed the database with db seed with seed script', () => {

packages/cli/test/db/push.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ describe('CLI db commands test', () => {
1313
it('should generate a database with db push', () => {
1414
const workDir = createProject(model);
1515
runCli('db push', workDir);
16-
expect(fs.existsSync(path.join(workDir, 'zenstack/dev.db'))).toBe(true);
16+
expect(fs.existsSync(path.join(workDir, 'zenstack/test.db'))).toBe(true);
1717
});
1818
});

packages/cli/test/migrate.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,24 @@ describe('CLI migrate commands test', () => {
1313
it('should generate a database with migrate dev', () => {
1414
const workDir = createProject(model);
1515
runCli('migrate dev --name init', workDir);
16-
expect(fs.existsSync(path.join(workDir, 'zenstack/dev.db'))).toBe(true);
16+
expect(fs.existsSync(path.join(workDir, 'zenstack/test.db'))).toBe(true);
1717
expect(fs.existsSync(path.join(workDir, 'zenstack/migrations'))).toBe(true);
1818
});
1919

2020
it('should reset the database with migrate reset', () => {
2121
const workDir = createProject(model);
2222
runCli('db push', workDir);
23-
expect(fs.existsSync(path.join(workDir, 'zenstack/dev.db'))).toBe(true);
23+
expect(fs.existsSync(path.join(workDir, 'zenstack/test.db'))).toBe(true);
2424
runCli('migrate reset --force', workDir);
25-
expect(fs.existsSync(path.join(workDir, 'zenstack/dev.db'))).toBe(true);
25+
expect(fs.existsSync(path.join(workDir, 'zenstack/test.db'))).toBe(true);
2626
});
2727

2828
it('should reset the database with migrate deploy', () => {
2929
const workDir = createProject(model);
3030
runCli('migrate dev --name init', workDir);
31-
fs.rmSync(path.join(workDir, 'zenstack/dev.db'));
31+
fs.rmSync(path.join(workDir, 'zenstack/test.db'));
3232
runCli('migrate deploy', workDir);
33-
expect(fs.existsSync(path.join(workDir, 'zenstack/dev.db'))).toBe(true);
33+
expect(fs.existsSync(path.join(workDir, 'zenstack/test.db'))).toBe(true);
3434
});
3535

3636
it('supports migrate status', () => {
@@ -51,7 +51,7 @@ describe('CLI migrate commands test', () => {
5151
fs.writeFileSync(path.join(workDir, 'zenstack/migrations', migration!, 'migration.sql'), 'invalid content');
5252

5353
// redeploy the migration, which will fail
54-
fs.rmSync(path.join(workDir, 'zenstack/dev.db'), { force: true });
54+
fs.rmSync(path.join(workDir, 'zenstack/test.db'), { force: true });
5555
try {
5656
runCli('migrate deploy', workDir);
5757
} catch {

0 commit comments

Comments
 (0)