Skip to content

Commit

Permalink
test: onReady hook
Browse files Browse the repository at this point in the history
  • Loading branch information
tpluscode committed Feb 12, 2025
1 parent d929eb7 commit e82e9b5
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions packages/core/test/lib/Kopflos.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,46 @@ describe('lib/Kopflos', () => {
await instance.stop()
})
})

describe('ready', () => {
it('calls onReady on plugins', async function () {
// given
const onReady = sinon.spy()
const plugin = class {
onReady = onReady
}
const instance = new Kopflos({
...config,
sparql: {
default: inMemoryClients(this.rdf),
},
}, {
plugins: [plugin],
})

// when
await instance.ready()

// then
expect(onReady).to.have.been.called
})

it('ignores plugins without onReady', async function () {
// given
const plugin = class {}
const instance = new Kopflos({
...config,
sparql: {
default: inMemoryClients(this.rdf),
},
}, {
plugins: [plugin],
})

// when
await instance.ready()
})
})
})

const testHandler: Handler = ({ subject, property, object }) => ({
Expand Down

0 comments on commit e82e9b5

Please sign in to comment.