IF Commons GitHub

sql/quality/run

Written to: 3 requirements: 3 proved, 0 partly, 0 failing, 0 with no test recorded. 0052-sql-quality FR-006, 0052-sql-quality FR-008, 0052-sql-quality FR-007

Running data tests (commons data 0052-sql-quality): each test is one query that counts the rows that are wrong (or the number failCalc gives), the count is judged by the thresholds, the failures are stored where the test asks for it, and the results are a sum that is told as TAP. A test that cannot run (the SQL is wrong, a table is missing) is an error, not a pass.

Source: commons/data/sql/quality/run.ts

4 of 6 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

countQueryfunctionno test imports it
function countQuery(test: DqTest, d: Dialect): string

The query that gives the number of a test, for a dialect.

previewfunction
function preview(tests: readonly DqTest[], driver: Driver, d: Dialect, sample?: number): Promise<readonly Impact[]>

What a set of tests would find on data that is already in a database (the last week's, or a staging table): the rule-impact preview. A proposed rule is run before it is deployed and its failures are reported with a sample of the rows, so that the cost of a stricter rule is known before it rejects anything. Nothing is written.

ParameterWhat it is
teststhe proposed tests
driverthe database
dits dialect
samplehow many failing rows to show for each test; 5 where not given

Imported by 7 tests of the run (7 passed, 0 failed): the library's results

runTestsfunction
function runTests(tests: readonly DqTest[], driver: Driver, d: Dialect): Promise<readonly Outcome[]>

Runs the tests, one after another, and tells what each found. A disabled test is skipped and is not run.

Imported by 7 tests of the run (7 passed, 0 failed): the library's results

storedAsconstno test imports it
const storedAs: (test: DqTest, d: Dialect) => string

Where a test's failures are stored.

summaryfunction
function summary(outcomes: readonly Outcome[]): { readonly pass: number; readonly warn: number; readonly fail: number; readonly error: number; readonly skipped: number; readonly ok: boolean; }

The counts of a run, and whether it is good: it is where nothing failed and nothing was an error (a warning is not a failure).

Imported by 7 tests of the run (7 passed, 0 failed): the library's results

toTapfunction
function toTap(outcomes: readonly Outcome[]): readonly TapNode[]

The results as TAP: a pass is a test that is ok; a warning is ok with a todo directive that says it; a failure and an error are not ok and carry what was found; a skipped test is skipped.

Imported by 7 tests of the run (7 passed, 0 failed): the library's results

Titles, headings, exports, tables, columns and requirements. Esc closes.