Skip to content

Commit db4aa22

Browse files
committed
fix tests
1 parent 5b4c2c7 commit db4aa22

File tree

3 files changed

+57
-0
lines changed

3 files changed

+57
-0
lines changed

packages/language/test/delegate.test.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ import { loadSchema, loadSchemaWithError } from './utils';
55
describe('Delegate Tests', () => {
66
it('supports inheriting from delegate', async () => {
77
const model = await loadSchema(`
8+
datasource db {
9+
provider = 'sqlite'
10+
url = 'file:./dev.db'
11+
}
12+
813
model A {
914
id Int @id @default(autoincrement())
1015
x String
@@ -24,6 +29,11 @@ describe('Delegate Tests', () => {
2429
it('rejects inheriting from non-delegate models', async () => {
2530
await loadSchemaWithError(
2631
`
32+
datasource db {
33+
provider = 'sqlite'
34+
url = 'file:./dev.db'
35+
}
36+
2737
model A {
2838
id Int @id @default(autoincrement())
2939
x String
@@ -40,6 +50,11 @@ describe('Delegate Tests', () => {
4050
it('can detect cyclic inherits', async () => {
4151
await loadSchemaWithError(
4252
`
53+
datasource db {
54+
provider = 'sqlite'
55+
url = 'file:./dev.db'
56+
}
57+
4358
model A extends B {
4459
x String
4560
@@delegate(x)
@@ -57,6 +72,11 @@ describe('Delegate Tests', () => {
5772
it('can detect duplicated fields from base model', async () => {
5873
await loadSchemaWithError(
5974
`
75+
datasource db {
76+
provider = 'sqlite'
77+
url = 'file:./dev.db'
78+
}
79+
6080
model A {
6181
id String @id
6282
x String
@@ -74,6 +94,11 @@ describe('Delegate Tests', () => {
7494
it('can detect duplicated attributes from base model', async () => {
7595
await loadSchemaWithError(
7696
`
97+
datasource db {
98+
provider = 'sqlite'
99+
url = 'file:./dev.db'
100+
}
101+
77102
model A {
78103
id String @id
79104
x String

packages/language/test/import.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ describe('Import tests', () => {
1212
fs.writeFileSync(
1313
path.join(name, 'a.zmodel'),
1414
`
15+
datasource db {
16+
provider = 'sqlite'
17+
url = 'file:./dev.db'
18+
}
19+
1520
model A {
1621
id Int @id
1722
name String
@@ -48,6 +53,12 @@ enum Role {
4853
path.join(name, 'b.zmodel'),
4954
`
5055
import './a'
56+
57+
datasource db {
58+
provider = 'sqlite'
59+
url = 'file:./dev.db'
60+
}
61+
5162
model User {
5263
id Int @id
5364
role Role
@@ -65,6 +76,12 @@ model User {
6576
path.join(name, 'a.zmodel'),
6677
`
6778
import './b'
79+
80+
datasource db {
81+
provider = 'sqlite'
82+
url = 'file:./dev.db'
83+
}
84+
6885
model A {
6986
id Int @id
7087
b B?

packages/language/test/mixin.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ import { DataModel, TypeDef } from '../src/ast';
55
describe('Mixin Tests', () => {
66
it('supports model mixing types to Model', async () => {
77
const model = await loadSchema(`
8+
datasource db {
9+
provider = 'sqlite'
10+
url = 'file:./dev.db'
11+
}
12+
813
type A {
914
x String
1015
}
@@ -25,6 +30,11 @@ describe('Mixin Tests', () => {
2530

2631
it('supports model mixing types to type', async () => {
2732
const model = await loadSchema(`
33+
datasource db {
34+
provider = 'sqlite'
35+
url = 'file:./dev.db'
36+
}
37+
2838
type A {
2939
x String
3040
}
@@ -52,6 +62,11 @@ describe('Mixin Tests', () => {
5262
it('can detect cyclic mixins', async () => {
5363
await loadSchemaWithError(
5464
`
65+
datasource db {
66+
provider = 'sqlite'
67+
url = 'file:./dev.db'
68+
}
69+
5570
type A with B {
5671
x String
5772
}

0 commit comments

Comments
 (0)