Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions __tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ describe('VueTypes', () => {

describe('`.extend` helper', () => {
it('should add getter prop to the library', () => {
const validator = jest.fn()
const validator = vi.fn()
interface VueTypesDate extends VueTypesType {
date: VueTypeDef<Date>
}
Expand Down Expand Up @@ -247,7 +247,7 @@ describe('VueTypes', () => {
})

it('should pass configuration params to the validator method', () => {
const validator = jest.fn()
const validator = vi.fn()
interface VueTypesDateFnArgs extends VueTypesType {
dateFnArgs: (...args: any[]) => VueTypeDef<Date>
}
Expand Down Expand Up @@ -341,7 +341,7 @@ describe('VueTypes', () => {

it('should inherit from vue-types type and add custom validation', () => {
const parent = VueTypes.string
const validator = jest.fn(() => true)
const validator = vi.fn(() => true)

interface VueTypesAliasValidate extends VueTypesType {
stringValidationAlias: VueTypeValidableDef<string>
Expand All @@ -368,7 +368,7 @@ describe('VueTypes', () => {
number: VueTypes.oneOf([1, 2, 3] as const),
}).isRequired.loose

const spy = jest.spyOn(parent, 'validator')
const spy = vi.spyOn(parent, 'validator')

VueTypes.extend({
name: 'shapeAlias',
Expand Down Expand Up @@ -458,7 +458,7 @@ describe('VueTypes', () => {

it('should inherit from vue-types type (non-getter types)', () => {
const parent = VueTypes.string
const validator = jest.fn()
const validator = vi.fn()

VueTypes.extend({
name: 'aliasMinLength',
Expand Down
6 changes: 0 additions & 6 deletions __tests__/jest.setup.js

This file was deleted.

2 changes: 0 additions & 2 deletions __tests__/shim.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
process.env.NODE_ENV = 'production'

import { noop } from '../src/utils'
import VueTypes, { fromType, toValidableType, toType } from '../src/shim'

Expand Down
14 changes: 7 additions & 7 deletions __tests__/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ describe('`isComplexType()`', () => {

describe('`bindTo()`', () => {
it('binds a function and store its original value', () => {
const fn = jest.fn()
const fn = vi.fn()
const ctx = {}
const bound = utils.bindTo(fn, ctx)

Expand Down Expand Up @@ -129,7 +129,7 @@ describe('`validateType()`', () => {
})

it('should execute the validator for type === null', () => {
const validator = jest.fn().mockReturnValue(false)
const validator = vi.fn().mockReturnValue(false)
expect(utils.validateType({ type: null, validator }, 'anyValue')).toBe(
false,
)
Expand All @@ -146,7 +146,7 @@ describe('`toType()`', () => {
})

it('should bind provided `validator function to the passed in object`', () => {
const spy = jest.fn()
const spy = vi.fn()
const obj = {
validator: spy,
}
Expand Down Expand Up @@ -275,7 +275,7 @@ describe('`toValidableType()`', () => {
expect(type.validate).toBeInstanceOf(Function)
})
it('the validate function sets a custom validator', () => {
const fn = jest.fn()
const fn = vi.fn()
const type = utils
.toValidableType('testType', { type: String })
.validate(fn)
Expand All @@ -285,7 +285,7 @@ describe('`toValidableType()`', () => {
expect(fn).toHaveBeenCalledWith('demo')
})
it('binds the validate function to the type object', () => {
const fn = jest.fn()
const fn = vi.fn()
const type = utils
.toValidableType('testType', { type: String })
.validate(fn)
Expand Down Expand Up @@ -332,9 +332,9 @@ describe('`fromType()`', () => {

it('composes validator functions', () => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const validator = jest.fn((...args: any[]) => true)
const validator = vi.fn((...args: any[]) => true)
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const validatorCopy = jest.fn((...args: any[]) => false)
const validatorCopy = vi.fn((...args: any[]) => false)
const base = utils.toType('a', {
type: String,
validator,
Expand Down
2 changes: 1 addition & 1 deletion __tests__/validators/custom.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('`.custom`', () => {
})

it('should trigger the validator in validateType', () => {
const spy = jest.fn().mockReturnValue(true)
const spy = vi.fn().mockReturnValue(true)
const type = custom(spy)
expect(validateType(type, '__TEST__')).toBe(true)
expect(spy).toHaveBeenCalledWith('__TEST__')
Expand Down
5 changes: 5 additions & 0 deletions __tests__/vitest.setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
console.log = vi.fn()
console.warn = vi.fn()
console.error = vi.fn()
console.debug = vi.fn()
console.info = vi.fn()
Loading