countQueryfunctionno test imports itfunction countQuery(test: DqTest, d: Dialect): stringThe query that gives the number of a test, for a dialect.
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.
countQueryfunctionno test imports itfunction countQuery(test: DqTest, d: Dialect): stringThe query that gives the number of a test, for a dialect.
previewfunctionfunction 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.
| Parameter | What it is |
|---|---|
tests | the proposed tests |
driver | the database |
d | its dialect |
sample | how many failing rows to show for each test; 5 where not given |
runTestsfunctionfunction 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.
storedAsconstno test imports itconst storedAs: (test: DqTest, d: Dialect) => stringWhere a test's failures are stored.
summaryfunctionfunction 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).
toTapfunctionfunction 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.