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 encode DML object statements', () => {
const stub = sandbox.stub(transaction, 'request');
transaction.batchUpdate(OBJ_STATEMENTS, assert.ifError);
const {reqOpts} = stub.lastCall.args[0];
assert.deepStrictEqual(reqOpts.statements, FORMATTED_STATEMENTS);
});
it('should unpack a poweron packet', function(){
var data_packet = fs.readFileSync('tests/data/packets/poweron')
var poweron_request = Packer(data_packet)
var message = poweron_request.unpack()
assert.deepStrictEqual(message.type, 'simple')
assert.deepStrictEqual(message.name, 'poweron')
assert.deepStrictEqual(message.packet_decoded.liveid, 'FD00112233FFEE66')
});
it('eqOrdering', () => {
assert.deepStrictEqual(eqOrdering.equals(-1, -1), true)
assert.deepStrictEqual(eqOrdering.equals(-1, 0), false)
assert.deepStrictEqual(eqOrdering.equals(-1, 1), false)
assert.deepStrictEqual(eqOrdering.equals(0, -1), false)
assert.deepStrictEqual(eqOrdering.equals(0, 0), true)
assert.deepStrictEqual(eqOrdering.equals(0, 1), false)
assert.deepStrictEqual(eqOrdering.equals(1, -1), false)
assert.deepStrictEqual(eqOrdering.equals(1, 0), false)
assert.deepStrictEqual(eqOrdering.equals(1, 1), true)
})
it('should serialize proxied functions', function () {
var defProxy = new Proxy(function (d, e, f) { return 'whatever' }, {})
assert.deepStrictEqual(stringify(defProxy), 'function () { ... }')
})
}
responses = test.responses;
TABLE.maxRetries = test.max_retries;
TABLE.createReadStream(test.createReadStream_options)
.on('data', row => rowKeysRead[rowKeysRead.length - 1].push(row.id))
.on('end', () => (endCalled = true))
.on('error', err => (error = err));
clock.runAll();
if (test.error) {
assert(!endCalled, `.on('end') should not have been invoked`);
assert.strictEqual(error.code, test.error);
} else {
assert(endCalled, `.on('end') shoud have been invoked`);
assert.ifError(error);
}
assert.deepStrictEqual(rowKeysRead, test.row_keys_read);
assert.strictEqual(
responses.length,
0,
'not all the responses were used'
);
assert.deepStrictEqual(requestedOptions, test.request_options);
});
});
fs.access(__filename, fs.R_OK, common.mustCall(function(...args) {
assert.deepStrictEqual(args, [null]);
}));
fs.promises.access(__filename, fs.R_OK)
'http',
':authority',
`localhost:${server.address().port}`,
':method',
'GET',
'www-authenticate',
'foo',
'www-authenticate',
'bar',
'www-authenticate',
'baz',
'test',
'foo, bar, baz'
];
assert.deepStrictEqual(rawHeaders, expected);
stream.respond(src);
stream.end();
}));
spanner.request = config => {
const [projectId, name] = stub.lastCall.args;
assert.strictEqual(projectId, spanner.projectId);
assert.strictEqual(name, NAME);
assert.deepStrictEqual(CONFIG, ORIGINAL_CONFIG);
assert.strictEqual(config.client, 'InstanceAdminClient');
assert.strictEqual(config.method, 'createInstance');
const reqOpts = config.reqOpts;
assert.deepStrictEqual(reqOpts, {
parent: 'projects/' + spanner.projectId,
instanceId: NAME,
instance: extend(
{
name: PATH,
displayName: NAME,
},
CONFIG
),
});
done();
onAuthenticated(
err: Error,
authenticatedReqOpts: DecorateRequestOptions
) {
assert.ifError(err);
assert.deepStrictEqual(reqOpts, authenticatedReqOpts);
done();
},
});
translate.request = (reqOpts: r.OptionsWithUri) => {
assert.strictEqual(reqOpts.uri, '/languages');
assert.deepStrictEqual(reqOpts.qs, {
target: 'es',
});
done();
};