14
test/support/test-data.ts
Normal file
14
test/support/test-data.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { loadQkforceTestData } from './qkforce-test-data.mjs';
|
||||
|
||||
export type QkforceScalarType = 'string' | 'integer' | 'number' | 'boolean' | 'date';
|
||||
export interface QkforceTypeDescriptor { type: QkforceScalarType; nullable?: boolean; }
|
||||
export type QkforceTypeRule = QkforceScalarType | QkforceTypeDescriptor;
|
||||
export type QkforceTypedSchema = Readonly<Record<string, QkforceTypeRule>>;
|
||||
export type QkforceRawRow = Readonly<Record<string, string>>;
|
||||
export type QkforceTypedRow = Readonly<Record<string, string | number | boolean | null>>;
|
||||
export interface QkforceDatasetMetadata { readonly datasetId:string; readonly versionId:string; readonly versionNumber:number; readonly logicalName:string; readonly path:string; readonly sha256:string; readonly rowCount:number; readonly contentType:'text/csv; charset=utf-8'; }
|
||||
export interface QkforceDataset { readonly metadata:QkforceDatasetMetadata; readonly headers:readonly string[]; readonly rowCount:number; rows():readonly QkforceRawRow[]; row(index:number):QkforceRawRow; where(criteria:Readonly<Record<string,string>>):readonly QkforceRawRow[]; first(criteria:Readonly<Record<string,string>>):QkforceRawRow; typedRow(index:number,schema:QkforceTypedSchema):QkforceTypedRow; }
|
||||
export interface QkforceTestDataProvenance { readonly testDataLockSha256?:string; readonly testData?:readonly Readonly<{datasetId:string;versionId:string;sha256:string}>[]; }
|
||||
export interface QkforceTestDataProvider { readonly size:number; datasets():readonly QkforceDatasetMetadata[]; has(nameOrId:string):boolean; dataset(nameOrId:string):QkforceDataset; provenance():QkforceTestDataProvenance; }
|
||||
export interface LoadQkforceTestDataOptions { required?: boolean; }
|
||||
export function loadTestData(rootDirectory:string = process.cwd(), options:LoadQkforceTestDataOptions = {}):QkforceTestDataProvider { return loadQkforceTestData(rootDirectory, options) as QkforceTestDataProvider; }
|
||||
Reference in New Issue
Block a user