it('should return the messageheader ID and uri of the sent message', function () { assert.strictEqual(response.messageheader[0].id, '1183C73D-2E62-4F60-B610-30F160BDFBD5'); assert.strictEqual(response.messageheader[0].uri, 'https://api.esendex.com/v1.0/messageheaders/1183C73D-2E62-4F60-B610-30F160BDFBD5'); });
test('template', () => { // simple assert.strictEqual(labels.template('Foo Bar'), 'Foo Bar'); assert.strictEqual(labels.template('Foo${}Bar'), 'FooBar'); assert.strictEqual(labels.template('$FooBar'), ''); assert.strictEqual(labels.template('}FooBar'), '}FooBar'); assert.strictEqual(labels.template('Foo ${one} Bar', { one: 'value' }), 'Foo value Bar'); assert.strictEqual(labels.template('Foo ${one} Bar ${two}', { one: 'value', two: 'other value' }), 'Foo value Bar other value'); // conditional separator assert.strictEqual(labels.template('Foo${separator}Bar'), 'FooBar'); assert.strictEqual(labels.template('Foo${separator}Bar', { separator: { label: ' - ' } }), 'Foo - Bar'); assert.strictEqual(labels.template('${separator}Foo${separator}Bar', { value: 'something', separator: { label: ' - ' } }), 'Foo - Bar'); assert.strictEqual(labels.template('${value} Foo${separator}Bar', { value: 'something', separator: { label: ' - ' } }), 'something Foo - Bar'); // // real world example (macOS) let t = '${activeEditorShort}${separator}${rootName}'; assert.strictEqual(labels.template(t, { activeEditorShort: '', rootName: '', separator: { label: ' - ' } }), ''); assert.strictEqual(labels.template(t, { activeEditorShort: '', rootName: 'root', separator: { label: ' - ' } }), 'root'); assert.strictEqual(labels.template(t, { activeEditorShort: 'markdown.txt', rootName: 'root', separator: { label: ' - ' } }), 'markdown.txt - root'); // // real world example (other) t = '${dirty}${activeEditorShort}${separator}${rootName}${separator}${appName}'; assert.strictEqual(labels.template(t, { dirty: '', activeEditorShort: '', rootName: '', appName: '', separator: { label: ' - ' } }), ''); assert.strictEqual(labels.template(t, { dirty: '', activeEditorShort: '', rootName: '', appName: 'Visual Studio Code', separator: { label: ' - ' } }), 'Visual Studio Code'); assert.strictEqual(labels.template(t, { dirty: '', activeEditorShort: 'Untitled-1', rootName: '', appName: 'Visual Studio Code', separator: { label: ' - ' } }), 'Untitled-1 - Visual Studio Code'); assert.strictEqual(labels.template(t, { dirty: '', activeEditorShort: '', rootName: 'monaco', appName: 'Visual Studio Code', separator: { label: ' - ' } }), 'monaco - Visual Studio Code'); assert.strictEqual(labels.template(t, { dirty: '', activeEditorShort: 'somefile.txt', rootName: 'monaco', appName: 'Visual Studio Code', separator: { label: ' - ' } }), 'somefile.txt - monaco - Visual Studio Code'); assert.strictEqual(labels.template(t, { dirty: '* ', activeEditorShort: 'somefile.txt', rootName: 'monaco', appName: 'Visual Studio Code', separator: { label: ' - ' } }), '* somefile.txt - monaco - Visual Studio Code'); });
it('should respond with status code 409 Conflict', () => { assert.strictEqual(statusCode, 409) })
dummySocket.once('myservice testing', data => { assert.strictEqual(data, 'hi'); done(); });
volume.onSlice((sliceNum: number, data: Buffer) => { assert.strictEqual(sliceNum, k); k++; assert.strictEqual(data.length, sliceSize); }).on('end', () => {
it('with variadic arguments ', async () => assert.strictEqual(await proxy.$d(...[2, 3, 4]), 9))
dummySocket.once('testing', data => { assert.strictEqual(data, message); done(); });
sources.other.subscribe(x => { assert.strictEqual(x, 97); dispose(); done(); });
assert.ok(op.lt('', 'a')); assert.ok(op.lt(new Date(0), new Date())) assert.ok(op.le(1, 2)); assert.ok(op.ge(2, 1)); assert.ok(op.gt(2, 1)); assert.ok(op.eq(1, 1)); assert.ok(op.ne(1, 2)); assert.ok(op.is(1, 1)); assert.ok(op.isnt(1, 2)); assert.ok(op.isIn('isIn', op)); assert.ok(op.not(false)); assert.ok(op.truth(1)); assert.ok(op.and(1, true)); assert.ok(op.or(true, false)); assert.strictEqual(op.add(1, 2), 3); assert.strictEqual(op.sub(1, 2), -1); assert.strictEqual(op.mul(1, 2), 2); assert.strictEqual(op.div(1, 2), 0.5); assert.strictEqual(op.floordiv(1, 2), 0); assert.deepStrictEqual(op.divmod(1, 2), [0, 1]); assert.strictEqual(op.mod(1, 2), 1); assert.strictEqual(op.pos(-1), -1); assert.strictEqual(op.neg(-1), 1); assert.strictEqual(op.and_(1, 2), 0); assert.strictEqual(op.or_(1, 2), 3); assert.strictEqual(op.invert(1), -2); assert.strictEqual(op.xor(1, 2), 3); assert.strictEqual(op.lshift(1, 2), 4); assert.strictEqual(op.rshift(1, 2), 0);
it('should return the expected messageheader', function () { assert.strictEqual(message.id, 'CDEB3533-1F76-46D7-A2A9-0DAF8290F7FC'); assert.strictEqual(message.uri, 'http://api.esendex.com/v1.0/messageheaders/CDEB3533-1F76-46D7-A2A9-0DAF8290F7FC/'); assert.strictEqual(message.status, 'Delivered'); assert.strictEqual(message.laststatusat, '2010-01-01T12:00:05.000'); assert.strictEqual(message.submittedat, '2010-01-01T12:00:02.000'); assert.strictEqual(message.type, 'SMS'); assert.strictEqual(message.to.phonenumber, '447700900123'); assert.strictEqual(message.from.phonenumber, '447700900654'); assert.strictEqual(message.summary, 'Testing REST API'); assert.strictEqual(message.body.uri, 'http://api.esendex.com/v1.0/messageheaders/CDEB3533-1F76-46D7-A2A9-0DAF8290F7FC/body'); assert.strictEqual(message.direction, 'Outbound'); assert.strictEqual(message.parts, '1'); assert.strictEqual(message.username, '*****@*****.**'); assert.strictEqual(message.failurereason.code, '84'); assert.strictEqual(message.failurereason.description, 'Unrecognised address'); assert.strictEqual(message.failurereason.retryable, 'false'); });