vitest#fn TypeScript Examples
The following examples show how to use
vitest#fn.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: createMindmap.test.ts From remind with MIT License | 6 votes |
test('should onChange work', async () => {
expect.hasAssertions()
const onChange = fn(() => null)
const editorInstance: RefObject<ContributionAPI> = createMindmap(container, {
onChange,
})
editorInstance.current?.model.update((model) => {
model.root.title = 'test'
})
await delay(1000)
expect(onChange.mock.calls.length).toBe(1)
})
Example #2
Source File: history.test.ts From remind with MIT License | 6 votes |
test('support change callback', () => {
const onChange = fn(() => {
//
})
const history = new History()
history.addEventListener(History.EventTypes.change, onChange)
const state = getState()
history.pushSync(state)
expect(onChange.mock.calls.length).toBe(1)
})
Example #3
Source File: history.test.ts From remind with MIT License | 5 votes |
test("change callback isn't fired for History initialize", () => {
const onChange = fn(() => {
//
})
const history = new History()
history.addEventListener(History.EventTypes.change, onChange)
expect(onChange.mock.calls.length).toBe(0)
})