Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* fix(client): 2.29.1 fixes (#8720) * fix: publish script for patch-dev * fix(studio): add pnpm override for sdk version to 2.29.0 Co-authored-by: Pierre-Antoine Mills <pierreantoine.urvoy@gmail.com>
- Loading branch information
Showing
10 changed files
with
246 additions
and
153 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,4 +59,4 @@ | |
"ts-node": "10.2.0", | ||
"typescript": "4.3.5" | ||
} | ||
} | ||
} |
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
1 change: 1 addition & 0 deletions
1
packages/client/src/__tests__/integration/happy/prisma-promises/.gitignore
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 @@ | ||
!dev.db |
Binary file not shown.
29 changes: 29 additions & 0 deletions
29
packages/client/src/__tests__/integration/happy/prisma-promises/schema.prisma
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,29 @@ | ||
datasource db { | ||
provider = "sqlite" | ||
url = "file:dev.db" | ||
} | ||
|
||
generator client { | ||
provider = "prisma-client-js" | ||
} | ||
|
||
// / User model comment | ||
model User { | ||
id String @default(uuid()) @id | ||
email String @unique | ||
age Int | ||
// / name comment | ||
name String? | ||
posts Post[] | ||
} | ||
|
||
model Post { | ||
id String @default(cuid()) @id | ||
createdAt DateTime @default(now()) | ||
updatedAt DateTime @updatedAt | ||
published Boolean | ||
title String | ||
content String? | ||
authorId String? | ||
author User? @relation(fields: [authorId], references: [id]) | ||
} |
68 changes: 68 additions & 0 deletions
68
packages/client/src/__tests__/integration/happy/prisma-promises/test.ts
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,68 @@ | ||
import { getTestClient } from '../../../../utils/getTestClient' | ||
describe('prisma promises', () => { | ||
/** | ||
* Requests must get sent if we call `.catch` | ||
*/ | ||
test('catch', async () => { | ||
const PrismaClient = await getTestClient() | ||
const prisma = new PrismaClient() | ||
const handler = (e) => Promise.reject(e) | ||
|
||
const remove = await prisma.user.deleteMany().catch(handler) | ||
const queryRaw = await prisma.$queryRaw('SELECT 1').catch(handler) | ||
const executeRaw = await prisma | ||
.$executeRaw('DELETE FROM User') | ||
.catch(handler) | ||
const findMany = await prisma.user.findMany().catch(handler) | ||
|
||
expect(remove).toMatchInlineSnapshot(` | ||
Object { | ||
count: 0, | ||
} | ||
`) | ||
expect(queryRaw).toMatchInlineSnapshot(` | ||
Array [ | ||
Object { | ||
1: 1, | ||
}, | ||
] | ||
`) | ||
expect(executeRaw).toMatchInlineSnapshot(`0`) | ||
expect(findMany).toMatchInlineSnapshot(`Array []`) | ||
|
||
await prisma.$disconnect() | ||
}) | ||
|
||
/** | ||
* Requests must get sent if we call `.finally` | ||
*/ | ||
test('finally', async () => { | ||
const PrismaClient = await getTestClient() | ||
const prisma = new PrismaClient() | ||
const handler = () => {} | ||
|
||
const remove = await prisma.user.deleteMany().finally(handler) | ||
const queryRaw = await prisma.$queryRaw('SELECT 1').finally(handler) | ||
const executeRaw = await prisma | ||
.$executeRaw('DELETE FROM User') | ||
.finally(handler) | ||
const findMany = await prisma.user.findMany().finally(handler) | ||
|
||
expect(remove).toMatchInlineSnapshot(` | ||
Object { | ||
count: 0, | ||
} | ||
`) | ||
expect(queryRaw).toMatchInlineSnapshot(` | ||
Array [ | ||
Object { | ||
1: 1, | ||
}, | ||
] | ||
`) | ||
expect(executeRaw).toMatchInlineSnapshot(`0`) | ||
expect(findMany).toMatchInlineSnapshot(`Array []`) | ||
|
||
await prisma.$disconnect() | ||
}) | ||
}) |
Oops, something went wrong.