Skip to content

Commit

Permalink
fix(jest): testing what the conditions does rather than what it returns
Browse files Browse the repository at this point in the history
  • Loading branch information
drepram committed Mar 23, 2022
1 parent 35179fd commit 0225e68
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions libraries/SatelliteDB/SatelliteDB.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ describe('SatelliteDB', () => {
})

test('reinitializing schema', async () => {
expect(await db.initializeSchema()).toEqual(db.initializeSchema())
db.version = jest.fn()
await db.initializeSchema()
expect(db.version).not.toHaveBeenCalled()
})

test('restoring search indexes', async () => {
Expand Down Expand Up @@ -64,7 +66,9 @@ describe('SatelliteDB', () => {
expect(await db.search.friends.search('bar')?.[0]?.address).toEqual(
where.address,
)
expect(await db.initializeSearchIndexes()).toEqual(undefined)
db.keyValue = jest.fn()
await db.initializeSearchIndexes()
expect(db.keyValue).not.toHaveBeenCalled()
})

test('upserting records', async () => {
Expand Down

0 comments on commit 0225e68

Please sign in to comment.