Skip to content

Commit 8e07ef1

Browse files
committed
refactor: migrate tests from tsd to tstyche and update package.json
1 parent 532e71b commit 8e07ef1

3 files changed

Lines changed: 24 additions & 24 deletions

File tree

SQL.test-d.ts

Lines changed: 0 additions & 21 deletions
This file was deleted.

SQL.tst.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import SQL from '.'
2+
import { glue, map, SqlStatement } from '.'
3+
import { expect } from 'tstyche'
4+
5+
expect(SQL`SELECT 1`).type.toBe<SqlStatement>()
6+
expect(SQL`SELECT 1`).type.toBe<SQL.SqlStatement>()
7+
expect(SQL`SELECT `.append(SQL`1`)).type.toBe<SqlStatement>()
8+
expect(SQL`SELECT `.append(SQL`1`)).type.toBe<SQL.SqlStatement>()
9+
expect(glue([SQL`SELECT`, SQL`1`], ' ')).type.toBe<SqlStatement>()
10+
expect(SQL.glue([SQL`SELECT`, SQL`1`], ' ')).type.toBe<SQL.SqlStatement>()
11+
expect(SQL.map([1, 2, 3])).type.toBe<SQL.SqlStatement>()
12+
expect(SQL.map([1, 2, 3], x => x ** 2)).type.toBe<SQL.SqlStatement>()
13+
expect(map([1, 2, 3])).type.toBe<SQL.SqlStatement>()
14+
expect(map([1, 2, 3], x => x ** 2)).type.toBe<SQL.SqlStatement>()
15+
expect(SQL`SELECT 1`.debug).type.toBe<string>()
16+
expect(SQL`SELECT 1`.sql).type.toBe<string>()
17+
expect(SQL`SELECT 1`.text).type.toBe<string>()
18+
expect(SQL.unsafe('string')).type.toBe<{ value: string }>()
19+
expect(SQL.unsafe(1)).type.toBe<{ value: number }>()
20+
expect(SQL.quoteIdent('string')).type.toBe<{ value: string }>()
21+
expect(SQL`SELECT `.append).type.not.toBeCallableWith(`1`)

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
"types": "./SQL.d.ts",
77
"scripts": {
88
"test": "node --test *.test.js",
9-
"posttest": "tsd",
9+
"posttest": "tstyche",
1010
"test:security": "node ./sqlmap/sqlmap.js",
11-
"test:typescript": "tsd",
11+
"test:typescript": "tstyche",
1212
"pretest:security": "napa https://github.com/sqlmapproject/sqlmap && node ./sqlmap/db-init.js",
1313
"lint": "standard",
1414
"benchmark": "node benchmark/index.js"
@@ -33,7 +33,7 @@
3333
"pg": "^8.6.0",
3434
"sql-template-strings": "^2.2.2",
3535
"standard": "^17.0.0",
36-
"tsd": "^0.33.0"
36+
"tstyche": "^7.1.0"
3737
},
3838
"standard": {
3939
"ignore": [

0 commit comments

Comments
 (0)