assert.doesNotThrow(function () { throw new Error('bang!') })
assert.doesNotThrow(function () {})
// does not throws it('should not throw an error by hello world!', function() { process.chdir('test/docker/00'); let r; assert.doesNotThrow(() => { r = buildCommand('hello'); }); assert.isOk(r); assert.notEmpty(r); });
describe('MongoTenant', function() { describe('#Plugin', function() { it('should have correct mongoose plugin signature.', function() { assert(typeof mongoTenant === 'function', 'Expected mongo-tenant to be a function.'); }); it('should register as mongoose schema plugin.', function() { let testSchema = new mongoose.Schema({}); assert.doesNotThrow(() => { testSchema.plugin(mongoTenant); }); }); }); });
// does not throw: it('should not throw an error by correct arguments: key-value pairs: 1 level', function() { assert.doesNotThrow(() => { validateShortcuts({ branchA: 'isAString' }); }); });
describe('Middlewares', () => { describe('Response Middleware', () => { it('should not throw with supported protocol version', () => assert.doesNotThrow(() => response.version('H004'))); it('should throw with no unsupported protocol version', () => assert.throws(() => response.version('H003'))); }); describe('Signer Middleware', () => { it('should not throw with supported protocol version', () => assert.doesNotThrow(() => signer.version('H004'))); it('should throw with no unsupported protocol version', () => assert.throws(() => signer.version('H003'))); }); describe('Serializer Middleware', () => { it('should not throw with supported protocol version and ini operation', () => assert.doesNotThrow(() => serializer.use(ebics.Orders.INI, client))); it('should not throw with supported protocol version and download operation', () => assert.doesNotThrow(() => serializer.use(ebics.Orders.STA('2018-01-01', '2018-02-01'), client))); it('should not throw with supported protocol version and upload operation', () => assert.doesNotThrow(() => serializer.use(ebics.Orders.AZV('<xml />'), client))); it('should throw with no supported protocol version and ', () => assert.throws(() => serializer.use({ version: 'H004', operation: 'unspported' }, client))); it('should throw with no unuspported protocol version', () => assert.throws(() => serializer.use({ version: 'H003' }, client))); }); });
it('allows a path in constructor', () => { let bc = null; assert.doesNotThrow(() => { bc = new FileCoverage('/path/to/file'); }); assert.ok(bc.statementMap); assert.ok(bc.fnMap); assert.ok(bc.branchMap); assert.ok(bc.s); assert.ok(bc.f); assert.ok(bc.b); assert.ok(bc.getLineCoverage()); assert.equal(bc.path, '/path/to/file'); });
describe('BankLetter', () => { let bankLetterGenerator = null; it('creates an instance', () => assert.doesNotThrow(() => { bankLetterGenerator = new BankLetter({ client, bankName: 'Credit Suisse AG', template: readFileSync(join(__dirname, '../../templates/ini_de.hbs'), { encoding: 'utf8' }), }); })); it('genrates a letter', async () => assert.doesNotThrow(async () => bankLetterGenerator.generate())); it('throws with invalid serliazitaion path', async () => bankLetterGenerator.serialize('').catch(e => assert.instanceOf(e, Error))); it('serliaziers a letter to disk', async () => { createDir('.test_tmp'); await bankLetterGenerator.serialize('.test_tmp/test_letter.html').then(t => assert.equal(t, true)); assert.equal(existsSync('.test_tmp/test_letter.html'), true); }); });
describe('`setDebug()`', function() { it('should throw a `TypeError` when the `newVal` param is not a Boolean', function() { const formation = formationStamp({ nodeEvents: eventEmitterStamp() }); assert.throws( () => formation.setDebug(), TypeError, 'Expected `newVal` param to be a Boolean, but is `undefined`' ); assert.throws( () => formation.setDebug('test string'), TypeError, 'Expected `newVal` param to be a Boolean, but is `string`' ); }); it('should not throw a `TypeError` when the `newVal` param is a Boolean', function() { const formation = formationStamp({ nodeEvents: eventEmitterStamp() }); assert.doesNotThrow(() => formation.setDebug(false), TypeError); assert.equal(formation.setDebug(true), formation); assert.equal(formation.getDebug(), true); }); });
it('should not throw an error by empty objects', () => { assert.doesNotThrow(() => { let r = mergeDeep({}, {}); assert.isObject(r); assert.equal(Object.keys(r).length, 0); }); });
describe('Client', () => { describe('instantiating', () => { it('should throw with no options provided', () => assert.throws(() => new Client())); it('should throw with no url provided', () => assert.throws(() => new Client({}))); it('should throw with no partnerId provided', () => assert.throws(() => new Client({ url: 'https://myebics.com' }))); it('should throw with no userId provided', () => assert.throws(() => new Client({ url: 'https://myebics.com', partnerId: 'partnerId' }))); it('should throw with no hostId provided', () => assert.throws(() => new Client({ url: 'https://myebics.com', partnerId: 'partnerId', userId: 'userId' }))); it('should throw with no passphrase provided', () => assert.throws(() => new Client({ url: 'https://myebics.com', partnerId: 'partnerId', userId: 'userId', hostId: 'hostId', }))); it('should throw with no keyStorage provided', () => assert.throws(() => new Client({ url: 'https://myebics.com', partnerId: 'partnerId', userId: 'userId', hostId: 'hostId', passphrase: 'test', }))); it('should create an isntance without tracesStorage', () => assert.doesNotThrow(() => new Client({ url: 'https://myebics.com', partnerId: 'partnerId', userId: 'userId', hostId: 'hostId', passphrase: 'test', keyStorage: fsKeysStorage('./test.key'), }))); it('should create an isntance with tracesStorage', () => assert.doesNotThrow(() => new Client({ url: 'https://myebics.com', partnerId: 'partnerId', userId: 'userId', hostId: 'hostId', passphrase: 'test', keyStorage: fsKeysStorage('./test.key'), tracesStorage: tracesStorage('./'), }))); }); });
it('should not throw an error by correct arguments: key-value pairs: 2 level', function() { assert.doesNotThrow(() => { validateShortcuts({ branchA: { branchAA: 'isAString' } }); }); });
it('should not throw an error by correct arguments: key-value pairs: 3 level', function() { assert.doesNotThrow(() => { validateShortcuts({ branchA: { branchAA: { branchAAA: 'isAString' } } }); }); });
it('should not throw an error by correct arguments: key-value pairs x2: 1 level', function() { assert.doesNotThrow(() => { validateShortcuts({ branchB: 'isAString', branchA: { branchAA: { branchAAA: 'isAString' } } }); }); });
it('should not throw an error by correct arguments: key-value pairs x2: 2 & 3 level', function() { assert.doesNotThrow(() => { validateShortcuts({ branchB: { branchB: 'branchB' }, branchA: { branchAA: { branchAAA: 'isAString' } } }); }); });