Skip to content

Commit

Permalink
test: add test for extending Vine class
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Jul 11, 2023
1 parent 41bd3d5 commit a417418
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion tests/integration/validator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,18 @@
*/

import { test } from '@japa/runner'
import vine, { VineArray, VineBoolean, VineEnum, VineLiteral, VineNumber, VineObject, VineRecord, VineString, VineTuple } from '../../index.js'
import vine, {
Vine,
VineEnum,
VineTuple,
VineArray,
VineNumber,
VineObject,
VineRecord,
VineString,
VineLiteral,
VineBoolean,
} from '../../index.js'

test.group('Validator | metadata', () => {
test('pass metadata to the validation pipeline', async ({ assert }) => {
Expand Down Expand Up @@ -176,4 +187,12 @@ test.group('Validator | extend schema classes', () => {

assert.isTrue((vine.enum(['guest', 'moderator', 'admin']) as any).hasMultipleOptions())
})

test('extend Vine class', ({ assert }) => {
Vine.macro('money' as any, function (this: Vine) {
return true
})

assert.isTrue((vine as any).money())
})
})

0 comments on commit a417418

Please sign in to comment.