Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should be an object', function () {
expect(CardInfo._banks).to.be.an('object')
})it('exposes rows array, but not the columns', function () {
const table = new TabifyTable();
expect(table.rows).to.be.an('array');
expect(table.columns == null).to.be.ok();
});it('handles errors with convertEsError()', async () => {
const indices = [];
const esError = new Error('esError');
const convertedError = new Error('convertedError');
sandbox.stub(convertEsErrorNS, 'convertEsError', () => { throw convertedError; });
const callCluster = sinon.spy(async () => { throw esError; });
try {
await callFieldCapsApi(callCluster, indices);
throw new Error('expected callFieldCapsApi() to throw');
} catch (error) {
expect(error).to.be(convertedError);
sinon.assert.calledOnce(convertEsError);
expect(convertEsError.args[0][0]).to.be(indices);
expect(convertEsError.args[0][1]).to.be(esError);
}
});
});test('should run 10 times', function() {
expect(count).to.be.eql(10);
});it('should normalize a bucket object into an array', function () {
var bucket = {
buckets: {
foo: { doc_count: 1 },
bar: { doc_count: 2 }
}
};
var buckets = extractBuckets(bucket);
expect(buckets).to.be.an(Array);
expect(buckets).to.have.length(2);
expect(buckets[0]).to.have.property('key', 'foo');
expect(buckets[0]).to.have.property('doc_count', 1);
expect(buckets[1]).to.have.property('key', 'bar');
expect(buckets[1]).to.have.property('doc_count', 2);
});it('should log messages to the console and append not append a new line', function () {
logger = pluginLogger({ silent: false, quiet: false });
for (let i = 0; i < 10; i++) {
logger.log('.', true);
}
logger.log('Done!');
expect(process.stdout.write.callCount).to.be(13);
expect(process.stdout.write.getCall(0).args[0]).to.be('.');
expect(process.stdout.write.getCall(1).args[0]).to.be('.');
expect(process.stdout.write.getCall(2).args[0]).to.be('.');
expect(process.stdout.write.getCall(3).args[0]).to.be('.');
expect(process.stdout.write.getCall(4).args[0]).to.be('.');
expect(process.stdout.write.getCall(5).args[0]).to.be('.');
expect(process.stdout.write.getCall(6).args[0]).to.be('.');
expect(process.stdout.write.getCall(7).args[0]).to.be('.');
expect(process.stdout.write.getCall(8).args[0]).to.be('.');
expect(process.stdout.write.getCall(9).args[0]).to.be('.');
expect(process.stdout.write.getCall(10).args[0]).to.be('\n');
expect(process.stdout.write.getCall(11).args[0]).to.be('Done!');
expect(process.stdout.write.getCall(12).args[0]).to.be('\n');
});s.once('error', function(err){
expect(err.message).to.match(/Illegal attachments/);
done();
});
s.conn.on('upgrade', function(){.done(function(data) {
expect(data.success).to.be.ok();
});function testBinary (data) {
var byteArray = new Uint8Array(data);
for (var i = 0; i < byteArray.byteLength; i++) {
expect(byteArray[i]).to.be(i);
}
}
});existResults.forEach((existResult) => {
expect(existResult).equal(false);
});
});