-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.test.js
More file actions
33 lines (27 loc) · 1.01 KB
/
index.test.js
File metadata and controls
33 lines (27 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import assert from 'node:assert/strict'
import { describe, it } from 'node:test'
import { createRequire } from 'node:module'
const require = createRequire(import.meta.url)
import * as schema from './index.js'
describe('index', function () {
const testGroup = require('./lib/test/group.json')
const testUser = require('./lib/test/user.json')
const testNs = require('./lib/test/nameserver.json')
it('exports user', () => {
const testCase = JSON.parse(JSON.stringify(testUser))
const { error, value } = schema.user.v3.validate(testCase)
assert.ifError(error)
assert.deepEqual(testCase, value)
})
it('exports group', () => {
const testCase = JSON.parse(JSON.stringify(testGroup))
const { error, value } = schema.group.v3.validate(testCase)
assert.ifError(error)
assert.deepEqual(testCase, value)
})
it('exports nameserver', () => {
const testCase = JSON.parse(JSON.stringify(testNs))
const { error } = schema.nameserver.v3.validate(testCase)
assert.ifError(error)
})
})