-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for the Prisma schema generator.
Test the basic CRUD capability of the exposed Prisma models.
- Loading branch information
1 parent
db6a3bb
commit f13c6bc
Showing
12 changed files
with
933 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
*.schema |
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,23 @@ | ||
module default { | ||
type GameSession { | ||
multi link players: User { | ||
constraint exclusive; | ||
} | ||
required property num: int32; | ||
} | ||
|
||
abstract type Named { | ||
required property name: str; | ||
} | ||
|
||
type Post { | ||
required link author: User; | ||
required property body: str; | ||
} | ||
|
||
type User extending Named; | ||
|
||
type UserGroup extending Named { | ||
multi link users: User; | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
integration-tests/prisma/dbschema/migrations/00001-m1b5kog.edgeql
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,21 @@ | ||
CREATE MIGRATION m1b5kogggyycxixgy2mcrqu3ntk3hhagdcospowiernk6ddu6op6ia | ||
ONTO initial | ||
{ | ||
CREATE ABSTRACT TYPE default::Named { | ||
CREATE REQUIRED PROPERTY name: std::str; | ||
}; | ||
CREATE TYPE default::User EXTENDING default::Named; | ||
CREATE TYPE default::GameSession { | ||
CREATE MULTI LINK players: default::User { | ||
CREATE CONSTRAINT std::exclusive; | ||
}; | ||
CREATE REQUIRED PROPERTY num: std::int32; | ||
}; | ||
CREATE TYPE default::UserGroup EXTENDING default::Named { | ||
CREATE MULTI LINK users: default::User; | ||
}; | ||
CREATE TYPE default::Post { | ||
CREATE REQUIRED LINK author: default::User; | ||
CREATE REQUIRED PROPERTY body: std::str; | ||
}; | ||
}; |
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,2 @@ | ||
[edgedb] | ||
server-version = "nightly" |
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,9 @@ | ||
import createClient from "edgedb"; | ||
|
||
export default async () => { | ||
const client = createClient(); | ||
|
||
process.env._JEST_EDGEDB_VERSION = await client.queryRequiredSingleJSON( | ||
`select sys::get_version()`, | ||
); | ||
}; |
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,8 @@ | ||
module.exports = { | ||
preset: "ts-jest", | ||
testEnvironment: "node", | ||
testPathIgnorePatterns: ["./dist", "./esm", "./mts", "./cjs", "./deno"], | ||
globalSetup: "./globalSetup.ts", | ||
transform: {}, | ||
globals: {}, | ||
}; |
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,32 @@ | ||
{ | ||
"private": true, | ||
"name": "@edgedb/integration-prisma", | ||
"version": "0.0.0", | ||
"scripts": { | ||
"typecheck": "echo 'Integration tests - lts, skipping typecheck...'", | ||
"build": "echo 'Integration tests, no build output...'", | ||
"generate": "pwd && npx @edgedb/generate prisma --file prisma.schema && npx prisma generate --schema=prisma.schema", | ||
"test": "yarn test:ts", | ||
"test:ts": "pwd && yarn generate && NODE_OPTIONS=\"--experimental-vm-modules\" jest --testPathIgnorePatterns='(esm/.*|mts/.*|cjs/.*|deno/.*)' --detectOpenHandles --forceExit", | ||
"ci:integration-test": "tsx ./testRunner.ts", | ||
"bench:types": "cd ../.. && tsx integration-tests/lts/bench.ts" | ||
}, | ||
"devDependencies": { | ||
"@arktype/attest": "^0.7.8", | ||
"@edgedb/generate": "*", | ||
"@prisma/client": "^6.1.0", | ||
"@tsconfig/node-lts": "^20.1.3", | ||
"@types/jest": "^29.5.12", | ||
"@types/node": "^20.12.13", | ||
"conditional-type-checks": "^1.0.6", | ||
"jest": "^29.7.0", | ||
"prisma": "^6.1.0", | ||
"superjson": "1.13.3", | ||
"ts-jest": "^29.1.4", | ||
"typescript": "^5.5.2" | ||
}, | ||
"dependencies": { | ||
"edgedb": "*", | ||
"fast-check": "^3.19.0" | ||
} | ||
} |
Oops, something went wrong.