UNPKG

synctos

Version:

The Syncmaker. A tool to build comprehensive sync functions for Couchbase Sync Gateway.

30 lines (23 loc) 903 B
const testFixtureMaker = require('../src/testing/test-fixture-maker'); describe('Underscore.js library', () => { const testFixture = testFixtureMaker.initFromSyncFunction('build/sync-functions/test-underscore-js-sync-function.js'); afterEach(() => { testFixture.resetTestEnvironment(); }); it('allows a document that satisfies a custom validation constraint implemented with Underscore.js', () => { const doc = { _id: 'my-doc', type: 'underscoreDoc', myProp: 'foo.bar' }; testFixture.verifyDocumentCreated(doc); }); it('rejects a document that fails a custom validation constraint implemented with Underscore.js', () => { const doc = { _id: 'my-doc', type: 'underscoreDoc', myProp: 'foo & bar' }; testFixture.verifyDocumentNotCreated(doc, 'underscoreDoc', 'escaped value of "myProp" does not match raw value'); }); });