Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
pluginManager.pluginApi.event.file.beforeRender(beforeSpy);
pluginManager.pluginApi.event.file.afterRender(afterSpy);
try {
await instance.renderFileWithPlugins(
file,
{},
PluginEvents.file.beforeRender,
PluginEvents.file.afterRender
);
} catch (e) {
// noop
}
assert.equal(beforeSpy.callCount, 1);
assert.ok(beforeSpy.calledWith(file));
assert.equal(file.render.callCount, 1);
assert.ok(file.render.calledWith({}));
assert.equal(afterSpy.callCount, 1);
assert.ok(afterSpy.calledWith(file, renderContent));
});
});
error = e;
}
assert.ok(!error);
assert.equal(called, true);
called = false;
// The validator function above should now fail
shouldSucceed = false;
try {
yield m.validate();
} catch (e) {
error = e;
}
assert.ok(error);
assert.ok(error instanceof ValidationError);
done();
})();
});
it('has isEqual() method', function() {
let coll1 = firestore.collection('coll1');
let coll1Equals = firestore.collection('coll1');
let coll2 = firestore.collection('coll2');
assert.ok(coll1.isEqual(coll1Equals));
assert.ok(!coll1.isEqual(coll2));
});
});
it('has limit() method', function() {
let query = firestore.collection('collectionId');
assert.ok(query.limit);
});
it('has isEqual() method', function() {
let doc1 = firestore.doc('coll/doc1');
let doc1Equals = firestore.doc('coll/doc1');
let doc2 = firestore.doc('coll/doc1/coll/doc1');
assert.ok(doc1.isEqual(doc1Equals));
assert.ok(!doc1.isEqual(doc2));
});
});
it('should call YT.Player.prototype.destroy()', () => {
const component = {
beforeDestroy: YouTubePlayer.beforeDestroy
}
const player = new container.YT.Player(null, null)
component.player = player
sinon.spy(player, 'destroy')
component.beforeDestroy()
assert.ok(player.destroy.called)
assert.ok(typeof component.player === 'undefined')
})
})
to.obj(function(newFile, enc, next) {
assert.ok(newFile, 'emits a file');
assert.ok(newFile.path, 'file has a path');
assert.ok(newFile.relative, 'file has relative path information');
assert.ok(newFile.contents, 'file has contents');
assert.ok(newFile instanceof Vinyl, 'file is Vinyl');
assert.ok(
newFile.contents instanceof Buffer,
'file contents are a buffer'
);
assert.equal(String(newFile.contents), testContentsExpected);
next();
})
],
function verifyResponse(writeResults) {
assert.ok(writeResults[0].writeTime.isEqual(new Firestore.Timestamp(0, 0)));
assert.ok(writeResults[1].writeTime.isEqual(new Firestore.Timestamp(1, 1)));
assert.ok(writeResults[2].writeTime.isEqual(new Firestore.Timestamp(2, 2)));
assert.ok(writeResults[3].writeTime.isEqual(new Firestore.Timestamp(3, 3)));
}
const queryEquals = (equals, notEquals) => {
for (let i = 0; i < equals.length; ++i) {
for (const equal of equals) {
assert.ok(equals[i].isEqual(equal));
assert.ok(equal.isEqual(equals[i]));
}
for (const notEqual of notEquals) {
assert.ok(!equals[i].isEqual(notEqual));
assert.ok(!notEqual.isEqual(equals[i]));
}
}
};
to.obj(function(newFile, enc, next) {
assert.ok(newFile, 'emits a file');
assert.ok(newFile.path, 'file has a path');
assert.ok(newFile.relative, 'file has relative path information');
assert.ok(newFile.contents, 'file has contents');
assert.ok(newFile instanceof Vinyl, 'file is Vinyl');
assert.ok(
newFile.contents instanceof Buffer,
'file contents are a buffer'
);
assert.equal(String(newFile.contents), testContentsOutput);
next();
})
],