Class: SqlAssertions
Defined in: src/testing/SqlAssertions.ts:12
Custom assertions for testing SQL generation and parameter bindings.
Accessors
sql
Get Signature
get sql():
string
Defined in: src/testing/SqlAssertions.ts:40
Returns
string
params
Get Signature
get params():
any[]
Defined in: src/testing/SqlAssertions.ts:44
Returns
any[]
Constructors
Constructor
new SqlAssertions(
target):SqlAssertions
Defined in: src/testing/SqlAssertions.ts:16
Parameters
| Parameter | Type |
|---|---|
target | string | QueryBuilder<any> | DbSet<any> | SqlQueryResult | { toSelectSql: () => SqlQueryResult; } |
Returns
SqlAssertions
Methods
toSQL()
toSQL(
expectedSql):this
Defined in: src/testing/SqlAssertions.ts:51
Asserts that the generated SQL exactly equals the expected SQL string (normalizing whitespace).
Parameters
| Parameter | Type |
|---|---|
expectedSql | string |
Returns
this
toContainSql()
toContainSql(
fragment):this
Defined in: src/testing/SqlAssertions.ts:65
Asserts that the generated SQL contains the given fragment.
Parameters
| Parameter | Type |
|---|---|
fragment | string |
Returns
this
toMatchParams()
toMatchParams(
expectedParams):this
Defined in: src/testing/SqlAssertions.ts:79
Asserts that the generated query params match the expected parameter array or values.
Parameters
| Parameter | Type |
|---|---|
expectedParams | any[] |
Returns
this