-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
1 parent
9a67ea2
commit 1c72bad
Showing
4 changed files
with
32 additions
and
13 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
Binary file not shown.
43 changes: 31 additions & 12 deletions
43
cli/sdk/src/__tests__/introspection/introspection.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 |
---|---|---|
@@ -1,16 +1,35 @@ | ||
// import { IntrospectionEngine } from '../../IntrospectionEngine' | ||
import { IntrospectionEngine } from '../../IntrospectionEngine' | ||
import path from 'path' | ||
|
||
// async function main() { | ||
// const engine = new IntrospectionEngine({ | ||
// cwd: __dirname, | ||
// }) | ||
test('basic introspection', async () => { | ||
const engine = new IntrospectionEngine({ | ||
cwd: __dirname, | ||
}) | ||
|
||
// const result = await engine.introspect('file:blog.db') | ||
// console.log(JSON.stringify(result)) | ||
// } | ||
const result = await engine.introspect( | ||
`file:${path.resolve(__dirname, 'blog.db')}`, | ||
) | ||
expect(result).toMatchInlineSnapshot(` | ||
"model User { | ||
age Int @default(0) | ||
amount Float @default(0) | ||
balance Float @default(0) | ||
email String @default(\\"''\\") @unique | ||
id Int @id | ||
name String? | ||
role String @default(\\"'USER'\\") | ||
posts Post[] | ||
} | ||
// main() | ||
|
||
test('introspection', () => { | ||
expect(1).toBe(1) | ||
model Post { | ||
author User | ||
content String? | ||
createdAt DateTime | ||
kind String? | ||
published Boolean @default(false) | ||
title String @default(\\"''\\") | ||
updatedAt DateTime | ||
uuid String @id(strategy: NONE) | ||
}" | ||
`) | ||
}) |
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