-
Notifications
You must be signed in to change notification settings - Fork 60
Expand file tree
/
Copy pathSQL.tst.ts
More file actions
21 lines (20 loc) · 1.07 KB
/
SQL.tst.ts
File metadata and controls
21 lines (20 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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`)