dexie-relationships
dexie-relationships copied to clipboard
oneToMany with no matches should get empty array instead of undefined
Basically, I would like to assert that when expecting an "albums" property, it should always be there. If no items matches, it should be empty instead of not defined at all:
db.bands.add({
id: 3,
name: 'Band without albums',
genreId: 1
})
const results = await db.bands.with({albums: 'albums'});
// Here's the assertion I would like to have:
assert (results.every(band => band.albums && Array.isArray(band.albums)));