chore: add test case to user searcher to register with spotlight on init
This commit is contained in:
@@ -2,6 +2,7 @@ import { beforeEach, describe, it, expect, vi } from "vitest"
|
||||
import { TestContainer } from "dioc/testing"
|
||||
import { UserSpotlightSearcherService } from "../user.searcher"
|
||||
import { nextTick, ref } from "vue"
|
||||
import { SpotlightService } from "../.."
|
||||
|
||||
async function flushPromises() {
|
||||
return await new Promise((r) => setTimeout(r))
|
||||
@@ -37,6 +38,22 @@ describe("UserSearcher", () => {
|
||||
actionsMock.invokeAction.mockReset()
|
||||
})
|
||||
|
||||
it("registers with the spotlight service upon initialization", async () => {
|
||||
const container = new TestContainer()
|
||||
|
||||
const registerSearcherFn = vi.fn()
|
||||
|
||||
container.bindMock(SpotlightService, {
|
||||
registerSearcher: registerSearcherFn,
|
||||
})
|
||||
|
||||
const user = container.bind(UserSpotlightSearcherService)
|
||||
await flushPromises()
|
||||
|
||||
expect(registerSearcherFn).toHaveBeenCalledOnce()
|
||||
expect(registerSearcherFn).toHaveBeenCalledWith(user)
|
||||
})
|
||||
|
||||
it("if login action is available, the search result should have the login result", async () => {
|
||||
const container = new TestContainer()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user