Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle upper case columns #103

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
cleanup unrelated errors
felixmosh committed Mar 6, 2019
commit d57533167c304432feb7b7f5be0506331d6de0d9
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
"main": "./src/index.js",
"types": "./src/index.d.ts",
"scripts": {
"lint": "tslint --project tsconfig.json --type-check 'src/**/*.ts' 'test/**/*.test.ts' 'bin/**/*.ts' --exclude '**/*.d.ts'",
"lint": "tslint --project tsconfig.json",
"build": "tsc",
"dependency-check": "dependency-check . --entry bin/schemats.js --missing --no-dev",
"test": "npm run lint && npm run build && npm run dependency-check && mocha",
4 changes: 2 additions & 2 deletions test/integration/cli.test.ts
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ describe('schemats cli tool integration testing', () => {
it('should run without error', () => {
let {status, stdout, stderr} = spawnSync('node', [
'bin/schemats', 'generate',
'-c', process.env.POSTGRES_URL,
'-c', process.env.POSTGRES_URL as string,
'-o', '/tmp/schemats_cli_postgres.ts'
], { encoding: 'utf-8' })
console.log('opopopopop', stdout, stderr)
@@ -27,7 +27,7 @@ describe('schemats cli tool integration testing', () => {
it('should run without error', () => {
let {status} = spawnSync('node', [
'bin/schemats', 'generate',
'-c', process.env.MYSQL_URL,
'-c', process.env.MYSQL_URL as string,
'-s', 'test',
'-o', '/tmp/schemats_cli_postgres.ts'
])
13 changes: 6 additions & 7 deletions test/testUtility.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as fs from 'mz/fs'
import { typescriptOfSchema, Database } from '../src/index'
import Options from '../src/options'
import * as ts from 'typescript';
import * as ts from 'typescript'

const diff = require('diff')
interface IDiffResult {
@@ -11,13 +10,14 @@ interface IDiffResult {
removed?: boolean
}

export function compile(fileNames: string[], options: ts.CompilerOptions): boolean {
export function compile (fileNames: string[], options: ts.CompilerOptions): boolean {
let program = ts.createProgram(fileNames, options)
let emitResult = program.emit()
let exitCode = emitResult.emitSkipped ? 1 : 0
return exitCode === 0
}
export async function compare(goldStandardFile: string, outputFile: string): Promise<boolean> {

export async function compare (goldStandardFile: string, outputFile: string): Promise<boolean> {

let gold = await fs.readFile(goldStandardFile, {encoding: 'utf8'})
let actual = await fs.readFile(outputFile, {encoding: 'utf8'})
@@ -38,15 +38,14 @@ export async function compare(goldStandardFile: string, outputFile: string): Pro
}
}


export async function loadSchema(db: Database, file: string) {
export async function loadSchema (db: Database, file: string) {
let query = await fs.readFile(file, {
encoding: 'utf8'
})
return await db.query(query)
}

export async function writeTsFile(inputSQLFile: string, inputConfigFile: string, outputFile: string, db: Database) {
export async function writeTsFile (inputSQLFile: string, inputConfigFile: string, outputFile: string, db: Database) {
await loadSchema(db, inputSQLFile)
const config: any = require(inputConfigFile)
let formattedOutput = await typescriptOfSchema(
8 changes: 7 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -14,6 +14,12 @@
"dts",
"test/actual",
"test/expected",
"test/fixture"
"test/fixture",
"**/*.d.ts"
],
"include": [
"src/**/*.ts",
"test/**/*.test.ts",
"bin/**/*.ts"
]
}