mirror of
https://github.com/logto-io/logto.git
synced 2025-01-20 21:32:31 -05:00
27 lines
582 B
TypeScript
27 lines
582 B
TypeScript
|
// Copied from core
|
||
|
|
||
|
import { QueryResult, QueryResultRow } from 'slonik';
|
||
|
import { PrimitiveValueExpression } from 'slonik/dist/src/types.d';
|
||
|
|
||
|
export type QueryType = (
|
||
|
sql: string,
|
||
|
values: readonly PrimitiveValueExpression[]
|
||
|
) => Promise<QueryResult<QueryResultRow>>;
|
||
|
|
||
|
/**
|
||
|
* Slonik Query Mock Utils
|
||
|
**/
|
||
|
export const expectSqlAssert = (sql: string, expectSql: string) => {
|
||
|
expect(
|
||
|
sql
|
||
|
.split('\n')
|
||
|
.map((row) => row.trim())
|
||
|
.filter(Boolean)
|
||
|
).toEqual(
|
||
|
expectSql
|
||
|
.split('\n')
|
||
|
.map((row) => row.trim())
|
||
|
.filter(Boolean)
|
||
|
);
|
||
|
};
|