Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
timsuchanek committed Mar 4, 2020
1 parent a3ef09b commit 0aa4808
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 177 deletions.
66 changes: 0 additions & 66 deletions cli/introspection/src/__tests__/replaceDatasource.test.ts

This file was deleted.

24 changes: 0 additions & 24 deletions cli/introspection/src/prompt/utils/replaceDatasource.ts

This file was deleted.

12 changes: 6 additions & 6 deletions cli/prisma2/__snapshots__/integrate.test.ts.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ datasource pg {
model posts {
id Int @default(autoincrement()) @id
published posts_status
published posts_status @default(DRAFT)
title String
}
Expand All @@ -404,7 +404,7 @@ datasource pg {
model posts {
id Int @default(autoincrement()) @id
published posts_status
published posts_status @default(DRAFT)
title String
}
Expand All @@ -427,7 +427,7 @@ datasource pg {
model posts {
id Int @default(autoincrement()) @id
published posts_status
published posts_status @default(DRAFT)
title String
}
Expand All @@ -450,7 +450,7 @@ datasource pg {
model posts {
id Int @default(autoincrement()) @id
published posts_status
published posts_status @default(DRAFT)
title String
}
Expand All @@ -473,7 +473,7 @@ datasource pg {
model posts {
id Int @default(autoincrement()) @id
published posts_status
published posts_status @default(DRAFT)
title String
}
Expand All @@ -496,7 +496,7 @@ datasource pg {
model posts {
id Int @default(autoincrement()) @id
published posts_status
published posts_status @default(DRAFT)
title String
}
Expand Down
4 changes: 2 additions & 2 deletions cli/prisma2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
},
"bin": "build/index.js",
"prisma": {
"version": "6cf3607cbc7213fac25b732e5323089fdd824611"
"version": "0a835f641b9b22405a0025fb6d1691dc6ac87e0c"
},
"devDependencies": {
"@prisma/ci-info": "^2.1.1",
Expand Down Expand Up @@ -86,4 +86,4 @@
"prepublishOnly": "pnpm run download && pnpm run ncc:download && pnpm run install && pnpm run test && pnpm run build",
"pkg": "pkg . -o pkg-build"
}
}
}
46 changes: 1 addition & 45 deletions cli/sdk/src/__tests__/engineCommands.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getDMMF, getConfig, dmmfToDml } from '../engineCommands'
import { getDMMF, getConfig } from '../engineCommands'
import fs from 'fs'
import path from 'path'

Expand Down Expand Up @@ -102,47 +102,3 @@ describe('getConfig', () => {
expect(config).toMatchSnapshot()
})
})

describe('dmmfToDml', () => {
test('basic usage', async () => {
const datamodel = `
datasource db {
url = "file:dev.db"
provider = "sqlite"
}
generator gen {
provider = "fancy-provider"
platforms = ["native"]
}
model A {
id Int @id
name String
}`
const dmmf = await getDMMF({ datamodel })
const config = await getConfig({ datamodel })

const printedDatamodel = await dmmfToDml({
dmmf: dmmf.datamodel,
config,
})

expect(printedDatamodel).toMatchInlineSnapshot(`
"generator gen {
provider = \\"fancy-provider\\"
platforms = \\"(array)\\"
}
datasource db {
provider = \\"sqlite\\"
url = \\"file:dev.db\\"
}
model A {
id Int @id
name String
}"
`)
})
})
34 changes: 0 additions & 34 deletions cli/sdk/src/engineCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,40 +240,6 @@ export async function getConfig({
}
}

export interface WholeDmmf {
dmmf: DMMF.Datamodel
config: ConfigMetaFormat
}

export async function dmmfToDml(
input: WholeDmmf,
prismaPath?: string,
): Promise<string> {
prismaPath = prismaPath || (await getPrismaPath())

const filePath = await tmpWrite(JSON.stringify(input))
try {
const args = ['cli', 'dmmf-to-dml', filePath]
debug(args)
const result = await execa(prismaPath, args, {
env: {
...process.env,
RUST_BACKTRACE: '1',
},
maxBuffer: MAX_BUFFER,
})

await unlink(filePath)

return result.stdout
} catch (e) {
if (e.stderr) {
throw new Error(chalk.redBright.bold('DMMF To DML ') + e.stderr)
}
throw new Error(e)
}
}

export async function getVersion(enginePath?: string): Promise<string> {
enginePath = enginePath || (await getPrismaPath())

Expand Down

0 comments on commit 0aa4808

Please sign in to comment.