import type { CRUDEngine } from '../engine' ; const TABLE_NAME = 'the-simpsons' ; interface DomainEntity { firstName : string ; lastName : string ; } export const readAllSpec = { 'returns multiple database records.' : async ( engine ) => { const homer = { entity : { firstName : 'Homer' , lastName : 'Simpson' , } , primaryKey : 'homer-simpson' , } ; const lisa = { entity : { firstName : 'Lisa' , lastName : 'Simpson' , } , primaryKey : 'lisa-simpson' , } ; const marge = { entity : { firstName : 'Marge' , lastName : 'Simpson' , } , primaryKey : 'marge-simpson' , } ; await engine . create ( TABLE_NAME , homer . primaryKey , homer . entity ) ; await engine . create ( TABLE_NAME , lisa . primaryKey , lisa . entity ) ; await engine . create ( TABLE_NAME , marge . primaryKey , marge . entity ) ; const records = await engine . readAll < DomainEntity > ( TABLE_NAME ) ; expect ( records . length ) . toBe ( 3 ) ; expect ( records ) . toEqual ( jasmine . arrayContaining ( [ homer . entity , lisa . entity , marge . entity ] ) ) ; } , } ;