import type { CRUDEngine } from '../engine' ; const TABLE_NAME = 'the-simpsons' ; export const readAllPrimaryKeysSpec = { 'gets the primary keys of all records in a table.' : 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 Promise . all ( [ engine . create ( TABLE_NAME , homer . primaryKey , homer . entity ) , engine . create ( TABLE_NAME , lisa . primaryKey , lisa . entity ) , engine . create ( TABLE_NAME , marge . primaryKey , marge . entity ) , ] ) ; const primaryKeys = await engine . readAllPrimaryKeys ( TABLE_NAME ) ; expect ( primaryKeys . length ) . toBe ( 3 ) ; expect ( primaryKeys . includes ( homer . primaryKey ) ) ; expect ( primaryKeys . includes ( lisa . primaryKey ) ) ; expect ( primaryKeys . includes ( marge . primaryKey ) ) ; } , } ;