Skip to content

Commit

Permalink
Adding integration test to check if SQLite is working for the nonce d…
Browse files Browse the repository at this point in the history
…atabase
  • Loading branch information
jamiehewitt15 committed Aug 8, 2024
1 parent 6eb4ec6 commit 225c22e
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/test/integration/database.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,41 @@ describe('NonceDatabase CRUD', () => {
})
})

describe('NonceDatabase CRUD with SQLite', () => {
let database: Database

before(async () => {
const dbConfig = {
url: '' // Empty URL to simulate no Typesense. Using SQLite instead
}
database = await new Database(dbConfig)
})

it('create nonce', async () => {
const result = await database.nonce.create('0x456', 0)
expect(result?.id).to.equal('0x456')
expect(result?.nonce).to.equal(0)
})

it('retrieve nonce', async () => {
const result = await database.nonce.retrieve('0x456')
expect(result?.id).to.equal('0x456')
expect(result?.nonce).to.equal(0)
})

it('update nonce', async () => {
const result = await database.nonce.update('0x456', 1)
expect(result?.id).to.equal('0x456')
expect(result?.nonce).to.equal(1)
})

it('delete nonce', async () => {
const result = await database.nonce.delete('0x456')
expect(result?.id).to.equal('0x456')
expect(result?.nonce).to.equal(1)
})
})

describe('IndexerDatabase CRUD', () => {
let database: Database
let existsPrevious: any = {}
Expand Down

0 comments on commit 225c22e

Please sign in to comment.