test("Taskr.constructor (values)", t => { const foo = { a: 'a', * b() {}} const fake = { file: "fake", cwd: fixtures, tasks: foo, plugins: foo } const taskr = new Taskr(fake) t.equal(taskr.file, fake.file, "accept `file` value") t.equal(taskr.root, fake.cwd, "accept `root|cwd` value") t.notEqual(taskr.plugins, fake.plugins, "reject invalid `plugins` value") t.notEqual(taskr.tasks, fake.tasks, "reject invalid `tasks` value") t.ok(taskr.tasks.b, "accept a `task` function") t.true($.isObject(taskr.tasks.b), "mount each `task` as an object") t.ok(taskr.tasks.b.data && taskr.tasks.b.func, "attach `data` and `func` keys to task's object") t.deepEqual(taskr.tasks.b.data, { files:[], globs:[], prevs:[] }, "start tasks with empty data arrays") t.notEqual(taskr.tasks.b.func, foo.b, "wrap the original function") t.end() })
// test ensures browserify configuration is applied in order // https://github.com/defunctzombie/zuul/issues/177 // entry file in this test starts off as: // console.log('foo') // if the configuration is applied in order, the result will be: // console.log('qux') // if not, it will likely be // console.log('bar') test('bundler', function (t) { const configs = [ { transform: path.join(fixtures, 'foo-to-bar-transform') }, { plugin: path.join(fixtures, 'bar-to-baz-plugin') }, { transform: path.join(fixtures, 'baz-to-qux-transform') } ] const files = [path.join(fixtures, 'entry.js')] const b = bundler(files, '.', configs, false) b.bundle(function (err, src) { t.ifError(err, 'no bundle error') t.notEqual(src.indexOf("console.log('qux')"), -1) t.end() }) })
test('common-log exports when NODESHIFT_QUIET is false', (t) => { const cache = process.env.NODESHIFT_QUIET; process.env.NODESHIFT_QUIET = false; const log = proxyquire('../lib/common-log', {})(); const noop = _ => {}; t.notEqual(log.info.toString(), noop.toString(), 'info method should not be noop'); t.notEqual(log.trace.toString(), noop.toString(), 'trace method should not be noop'); t.end(); // reset process.env process.env.NODESHIFT_QUIET = cache; });
test('Test findOne query with results', (assert) => { let query = OGMQueryBuilder.create('test').where(new OGMNeoWhere('name', { $eq: 'name1' })).ascOrderBy('name'); OGMNeoNode.findOne(query).then((node) => { assert.notEqual(node.id, null); assert.equal(node.name,'name1'); assert.end(); }); });
test('Test INVALID WRITE cypher', (assert) => { OGMNeoCypher.transactionalWrite(4324).catch((error) => { assert.notEqual(error,null); assert.equal(error.message, 'Cypher statements must to be a string or a non empty string array'); assert.end(); }); });
test('TEST DELETE relation', (assert) => { let rel = _.first(relations); assert.notEqual(rel, undefined); OGMNeoRelation.deleteRelation(rel.id).then((deletedRel) => { assert.equal(rel.id, deletedRel.id); assert.end(); }); });
test('Test Connection', (assert) => { assert.notEqual(OGMNeo.driver, null); assert.equal(OGMNeo.isConnected, true); assert.end(); });
test('Test create node with DATE param', (assert) => { OGMNeoNode.create({ name: 'name1', date: new Date(), array: ['das']}, 'test') .then((node) => { assert.notEqual(node, null); assert.notEqual(node.id, null); assert.deepEqual(node.name, 'name1'); assert.notEqual(node.date, null); assert.end(); }); });
test('Test EXECUTE READ Transactional cypher', (assert) => { OGMNeoCypher.transactionalRead('MATCH (n) RETURN n').then((result) => { assert.notEqual(result,null); assert.end(); }); });
test('Test FAIL update node', (assert) => { OGMNeoNode.update({ id: 'ddlkas', name: null, tes: 3 }).catch((error) => { assert.notEqual(error, null); assert.equals(error.message, 'Node must have an integer id to be updated'); assert.end(); }); });
test('Test success removing label', (assert) => { OGMNeoNode.removeLabelFromNode('label', nodeId).then((node) => { assert.notEqual(node, null); assert.equal(node.id, nodeId); assert.end(); }); });
test('Test drop index', (assert) => { OGMNeoIndex.drop('object', ['name','test']).then((result) => { assert.notEqual(result, null); assert.end(); }); });
test('Test create an index', (assert) => { OGMNeoIndex.create('object', ['name','test']).then((result) => { assert.notEqual(result, null); assert.end(); }); });
test("Taskr.constructor (values)", t => { const foo = { a: 'a', * b() {}} const fake = { file: "fake", cwd: fixtures, tasks: foo, plugins: foo } const taskr = new Taskr(fake) t.equal(taskr.file, fake.file, "accept `file` value") t.equal(taskr.root, fake.cwd, "accept `root|cwd` value") t.notEqual(taskr.plugins, fake.plugins, "reject invalid `plugins` value") t.notEqual(taskr.tasks, fake.tasks, "reject invalid `tasks` value") t.ok(taskr.tasks.b, "accept a `task` function") t.true($.isObject(taskr.tasks.b), "mount each `task` as an object") t.ok(taskr.tasks.b.data && taskr.tasks.b.func, "attach `data` and `func` keys to task's object") t.deepEqual(taskr.tasks.b.data, { files:[], globs:[], prevs:[] }, "start tasks with empty data arrays") t.notEqual(taskr.tasks.b.func, foo.b, "wrap the original function") t.end() })