Aktueller Stand
This commit is contained in:
15
backend/node_modules/fast-json-stringify/test/json-schema-test-suite/util.js
generated
vendored
15
backend/node_modules/fast-json-stringify/test/json-schema-test-suite/util.js
generated
vendored
@@ -2,25 +2,22 @@
|
||||
|
||||
const build = require('../..')
|
||||
|
||||
function runTests (t, testsuite, skippedTests) {
|
||||
async function runTests (t, testsuite, skippedTests) {
|
||||
for (const scenario of testsuite) {
|
||||
const stringify = build(scenario.schema)
|
||||
for (const test of scenario.tests) {
|
||||
if (skippedTests.indexOf(test.description) !== -1) {
|
||||
t.comment('skip %s', test.description)
|
||||
console.log(`skip ${test.description}`)
|
||||
continue
|
||||
}
|
||||
t.test(test.description, (t) => {
|
||||
|
||||
await t.test(test.description, (t) => {
|
||||
t.plan(1)
|
||||
try {
|
||||
const output = stringify(test.data)
|
||||
t.equal(output, JSON.stringify(test.data), 'compare payloads')
|
||||
t.assert.equal(output, JSON.stringify(test.data), 'compare payloads')
|
||||
} catch (err) {
|
||||
if (test.valid === false) {
|
||||
t.pass('payload is invalid')
|
||||
} else {
|
||||
t.fail('payload should be valid: ' + err.message)
|
||||
}
|
||||
t.assert.ok(test.valid === false, 'payload should be valid: ' + err.message)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user