mirror of
https://github.com/XiaoDaiGua-Ray/ray-template.git
synced 2025-04-05 06:50:05 +08:00
28 lines
547 B
TypeScript
28 lines
547 B
TypeScript
import { call } from '../../src/utils/vue/call'
|
|
|
|
describe('call', () => {
|
|
it('should be executed once', () => {
|
|
const fn = vi.fn()
|
|
|
|
call(() => fn())
|
|
|
|
expect(fn).toHaveBeenCalledTimes(1)
|
|
})
|
|
|
|
it('should be executed with an argument', () => {
|
|
const fn = vi.fn()
|
|
|
|
call((a: number) => fn(a), 1)
|
|
|
|
expect(fn).toHaveBeenCalledWith(1)
|
|
})
|
|
|
|
it('should be executed with multiple arguments', () => {
|
|
const fn = vi.fn()
|
|
|
|
call((a: number, b: number) => fn(a, b), 1, 2)
|
|
|
|
expect(fn).toHaveBeenCalledWith(1, 2)
|
|
})
|
|
})
|