Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
p: { type: Array },
'p.$': { type: String, uniforms: { transform: noop } },
r: { type: String, uniforms: { options: { a: 1, b: 2 } } },
s: {
type: String,
uniforms: {
options: [{ label: 1, value: 'a' }, { label: 2, value: 'b' }],
},
},
t: { type: String, uniforms: { options: () => ({ a: 1, b: 2 }) } },
u: { type: SimpleSchema.Integer },
w: { type: new SimpleSchema({ x: String }) },
x: { type: String, autoValue: () => '$setOnInsert:hack!' },
});
const bridge = new SimpleSchema2Bridge(schema);
describe('#check()', () => {
it('works correctly with schema', () => {
expect(SimpleSchema2Bridge.check(schema)).toBeTruthy();
});
it('works correctly without schema', () => {
expect(SimpleSchema2Bridge.check()).not.toBeTruthy();
});
Object.keys(schema).forEach(method => {
it(`works correctly without '${method}'`, () => {
expect(
SimpleSchema2Bridge.check({ ...schema, [method]: null }),
).not.toBeTruthy();
});
const createSchema = schema =>
new SimpleSchema2Bridge(new SimpleSchema(schema));
const createSchema = schema =>
new SimpleSchema2Bridge(new SimpleSchema(schema));
const createSchema = schema =>
new SimpleSchema2Bridge(new SimpleSchema(schema));
const createSchema = schema =>
new SimpleSchema2Bridge(new SimpleSchema(schema));
const createSchema = schema =>
new SimpleSchema2Bridge(new SimpleSchema(schema));
const createSchema = schema =>
new SimpleSchema2Bridge(new SimpleSchema(schema));