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.
73 lines
1.7 KiB
JavaScript
73 lines
1.7 KiB
JavaScript
const should = require('should');
|
|
const schema = require('../../schema');
|
|
|
|
describe('labelWhenVisible', () => {
|
|
it('should not error when label is gone and action is hidden', () => {
|
|
const definition = {
|
|
version: '1.0.0',
|
|
platformVersion: '1.0.0',
|
|
creates: {
|
|
foo: {
|
|
key: 'foo',
|
|
noun: 'Foo',
|
|
display: {
|
|
hidden: true,
|
|
},
|
|
operation: {
|
|
perform: '$func$2$f$',
|
|
},
|
|
},
|
|
},
|
|
};
|
|
|
|
const results = schema.validateAppDefinition(definition);
|
|
results.errors.should.have.length(0);
|
|
});
|
|
|
|
it('should error when label is missing and action is visible ', () => {
|
|
const definition = {
|
|
version: '1.0.0',
|
|
platformVersion: '1.0.0',
|
|
creates: {
|
|
foo: {
|
|
key: 'foo',
|
|
noun: 'Foo',
|
|
display: {
|
|
hidden: false,
|
|
},
|
|
operation: {
|
|
perform: '$func$2$f$',
|
|
},
|
|
},
|
|
},
|
|
};
|
|
|
|
const results = schema.validateAppDefinition(definition);
|
|
results.errors.should.have.length(1);
|
|
const err = results.errors[0];
|
|
should(err.codeLinks[0].includes('BasicDisplaySchema')).be.true();
|
|
err.property.should.eql('instance.creates.foo.display');
|
|
});
|
|
|
|
it('should error when label is alone when create is visible ', () => {
|
|
const definition = {
|
|
version: '1.0.0',
|
|
platformVersion: '1.0.0',
|
|
creates: {
|
|
foo: {
|
|
key: 'foo',
|
|
noun: 'Foo',
|
|
display: {
|
|
label: 'nea',
|
|
},
|
|
operation: {
|
|
perform: '$func$2$f$',
|
|
},
|
|
},
|
|
},
|
|
};
|
|
|
|
const results = schema.validateAppDefinition(definition);
|
|
results.errors.should.have.length(1);
|
|
});
|
|
});
|