Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
21 changes: 0 additions & 21 deletions SQL.test-d.ts

This file was deleted.

21 changes: 21 additions & 0 deletions SQL.tst.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import SQL from '.'
import { glue, map, SqlStatement } from '.'
import { expect } from 'tstyche'

expect(SQL`SELECT 1`).type.toBe<SqlStatement>()
expect(SQL`SELECT 1`).type.toBe<SQL.SqlStatement>()
expect(SQL`SELECT `.append(SQL`1`)).type.toBe<SqlStatement>()
expect(SQL`SELECT `.append(SQL`1`)).type.toBe<SQL.SqlStatement>()
expect(glue([SQL`SELECT`, SQL`1`], ' ')).type.toBe<SqlStatement>()
expect(SQL.glue([SQL`SELECT`, SQL`1`], ' ')).type.toBe<SQL.SqlStatement>()
expect(SQL.map([1, 2, 3])).type.toBe<SQL.SqlStatement>()
expect(SQL.map([1, 2, 3], x => x ** 2)).type.toBe<SQL.SqlStatement>()
expect(map([1, 2, 3])).type.toBe<SQL.SqlStatement>()
expect(map([1, 2, 3], x => x ** 2)).type.toBe<SQL.SqlStatement>()
expect(SQL`SELECT 1`.debug).type.toBe<string>()
expect(SQL`SELECT 1`.sql).type.toBe<string>()
expect(SQL`SELECT 1`.text).type.toBe<string>()
expect(SQL.unsafe('string')).type.toBe<{ value: string }>()
expect(SQL.unsafe(1)).type.toBe<{ value: number }>()
expect(SQL.quoteIdent('string')).type.toBe<{ value: string }>()
expect(SQL`SELECT `.append).type.not.toBeCallableWith(`1`)
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"types": "./SQL.d.ts",
"scripts": {
"test": "node --test *.test.js",
"posttest": "tsd",
"posttest": "tstyche",
"test:security": "node ./sqlmap/sqlmap.js",
"test:typescript": "tsd",
"test:typescript": "tstyche",
"pretest:security": "git clone --depth=1 https://github.com/sqlmapproject/sqlmap node_modules/sqlmap && node ./sqlmap/db-init.js",
"lint": "standard",
"benchmark": "node benchmark/index.js"
Expand All @@ -32,7 +32,7 @@
"pg": "^8.20.0",
"sql-template-strings": "^2.2.2",
"standard": "^17.1.2",
"tsd": "^0.33.0"
"tstyche": "^7.1.0"
},
"standard": {
"ignore": [
Expand Down
Loading