-
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
Showing
5 changed files
with
111 additions
and
21 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
23 changes: 23 additions & 0 deletions
23
cli/introspection/src/__tests__/__snapshots__/init.test.ts.snap
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 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`is schema wriiten on disk replace: | ||
We created [32mprisma/schema.prisma[39m for you. | ||
Edit it with your favorite editor to update your database connection so Prisma can connect to it. | ||
When done, run [32mprisma2 introspect[39m to test the connection and introspect the data model from your existing database. | ||
Then run [32mprisma2 generate[39m to generate a Prisma Client based on this data model that can be used in your application. | ||
More information in our documentation: | ||
http://tbd | ||
1`] = ` | ||
" | ||
We created [32mprisma/schema.prisma[39m for you. | ||
Edit it with your favorite editor to update your database connection so Prisma can connect to it. | ||
When done, run [32mprisma2 introspect[39m to test the connection and introspect the data model from your existing database. | ||
Then run [32mprisma2 generate[39m to generate a Prisma Client based on this data model that can be used in your application. | ||
More information in our documentation: | ||
http://tbd | ||
" | ||
`; |
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,31 @@ | ||
import { join } from 'path' | ||
import mkdir from 'make-dir' | ||
import { promisify } from 'util' | ||
import fs from 'fs' | ||
import rimraf from 'rimraf' | ||
import { Init } from '../commands/Init' | ||
|
||
const del = promisify(rimraf) | ||
const tmp = join(__dirname, '../../tmp') | ||
|
||
beforeEach(async () => { | ||
await del(tmp) | ||
await mkdir(tmp) | ||
}) | ||
|
||
beforeEach(async () => { | ||
await del(tmp) | ||
}) | ||
|
||
test('is schema wriiten on disk replace', async () => { | ||
const schemaPath = join(__dirname, '../commands/default.prisma') | ||
const defaultSchema = fs.readFileSync(schemaPath, 'utf-8') | ||
|
||
const init = Init.new() | ||
const result = await init.parse(['tmp']) | ||
|
||
const schema = fs.readFileSync(join(tmp, 'prisma/schema.prisma'), 'utf-8') | ||
|
||
expect(schema).toMatch(defaultSchema) | ||
expect(result).toMatchSnapshot(result) | ||
}) |
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