Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('recognizes a registered bridge', () => {
class TestSchema {}
class TestSchemaBridge extends Bridge {
static check(schema: any) {
return schema instanceof TestSchema;
}
}
createSchemaBridge.register(TestSchemaBridge);
expect(createSchemaBridge(new TestSchema())).toBeInstanceOf(
TestSchemaBridge
);
});
it('accepts a Bridge instance', () => {
const bridge = {
getError() {},
getErrorMessage() {},
getErrorMessages() {},
getField() {},
getInitialValue() {},
getProps() {},
getSubfields() {},
getType() {},
getValidator() {}
};
expect(createSchemaBridge(bridge)).toBe(bridge);
});
const createSchema = schema => createSchemaBridge(new SimpleSchema(schema))