Milestone 0: import zappier billing, Verae middleware, and Zapier research
Compose-ready workspace: packages/zappier (rate card, portal, Stripe), packages/verae-zapier-middleware (timestamp + NATS), packages/verae-zapier (CLI app), vendor/zapier-platform, and research/zapier vendor corpus. Gate 0 structure checks pass. Product code and research are not yet wired.
This commit is contained in:
commit
b4150c8250
1364 changed files with 6814366 additions and 0 deletions
46
vendor/zapier-platform/packages/schema/test/utils.js
vendored
Normal file
46
vendor/zapier-platform/packages/schema/test/utils.js
vendored
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
'use strict';
|
||||
|
||||
require('should');
|
||||
const { SKIP_KEY } = require('../lib/constants');
|
||||
|
||||
const testInlineSchemaExamples = (name) => {
|
||||
const Schema = require('../lib/schemas/' + name);
|
||||
const goods = Schema.schema.examples || [];
|
||||
const bads = Schema.schema.antiExamples || [];
|
||||
|
||||
describe(name, () => {
|
||||
it('valid example schemas should pass validation', function () {
|
||||
if (!goods.length) {
|
||||
this.skip();
|
||||
} else {
|
||||
goods
|
||||
.filter((t) => !t[SKIP_KEY])
|
||||
.forEach((good) => {
|
||||
const { errors } = Schema.validate(good);
|
||||
errors.should.have.length(0);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
it('invalid example schemas should fail validation', function () {
|
||||
if (!bads.length) {
|
||||
this.skip();
|
||||
} else {
|
||||
bads
|
||||
.filter((t) => !t[SKIP_KEY])
|
||||
.map((t) => t.example)
|
||||
.forEach((bad) => {
|
||||
const { errors } = Schema.validate(bad);
|
||||
if (errors.length === 0) {
|
||||
console.log(bad);
|
||||
}
|
||||
errors.should.not.have.length(0);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
testInlineSchemaExamples,
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue