-
-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
151 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,7 +71,7 @@ describe('CLI Plugins Tests', () => { | |
'[email protected]', | ||
'react', | ||
'swr', | ||
'@tanstack/react-query', | ||
'@tanstack/react-query@^4.0.0', | ||
'@trpc/server', | ||
'@prisma/client@^4.0.0', | ||
`${path.join(__dirname, '../../../../.build/zenstackhq-language-' + ver + '.tgz')}`, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { loadSchema } from '@zenstackhq/testtools'; | ||
|
||
describe('Regression: issue 764', () => { | ||
it('regression', async () => { | ||
const { prisma, enhance } = await loadSchema( | ||
` | ||
model User { | ||
id Int @id @default(autoincrement()) | ||
name String | ||
post Post? @relation(fields: [postId], references: [id]) | ||
postId Int? | ||
@@allow('all', true) | ||
} | ||
model Post { | ||
id Int @id @default(autoincrement()) | ||
title String | ||
User User[] | ||
@@allow('all', true) | ||
} | ||
` | ||
); | ||
|
||
const db = enhance(); | ||
|
||
const user = await prisma.user.create({ | ||
data: { name: 'Me' }, | ||
}); | ||
|
||
await db.user.update({ | ||
where: { id: user.id }, | ||
data: { | ||
post: { | ||
upsert: { | ||
create: { | ||
title: 'Hello World', | ||
}, | ||
update: { | ||
title: 'Hello World', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { loadSchema } from '@zenstackhq/testtools'; | ||
|
||
describe('Regression: issue 765', () => { | ||
it('regression', async () => { | ||
const { enhance } = await loadSchema( | ||
` | ||
model User { | ||
id Int @id @default(autoincrement()) | ||
name String | ||
post Post? @relation(fields: [postId], references: [id]) | ||
postId Int? | ||
@@allow('all', true) | ||
} | ||
model Post { | ||
id Int @id @default(autoincrement()) | ||
title String | ||
User User[] | ||
@@allow('all', true) | ||
} | ||
` | ||
); | ||
|
||
const db = enhance(); | ||
const r = await db.user.create({ | ||
data: { | ||
name: 'Me', | ||
post: undefined, | ||
}, | ||
}); | ||
expect(r.name).toBe('Me'); | ||
expect(r.post).toBeUndefined(); | ||
}); | ||
}); |