Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('includes usage params with all hits', function() {
browser.execute(ga.run, 'require', 'mediaQueryTracker');
browser.execute(ga.run, 'send', 'pageview');
browser.waitUntil(log.hitCountEquals(1));
var hits = log.getHits();
assert.strictEqual(hits[0].did, constants.DEV_ID);
assert.strictEqual(hits[0][constants.VERSION_PARAM], pkg.version);
// '8' = '0000001000' in hex
assert.strictEqual(hits[0][constants.USAGE_PARAM], '8');
});
pettyCache.bulkGet(keys, function(err, data) {
assert.ifError(err);
assert.strictEqual(Object.keys(data).length, 7);
assert.strictEqual(data[key1], '');
assert.strictEqual(data[key2], 0);
assert.strictEqual(data[key3], false);
assert.strictEqual(typeof data[key4], 'number');
assert(isNaN(data[key4]));
assert.strictEqual(data[key5], null);
assert.strictEqual(data[key6], undefined);
assert.strictEqual(data[key7], null);
// Wait for Redis cache to expire
setTimeout(function() {
// Ensure keys are not in Redis
pettyCache.bulkGet(keys, function(err, data) {
assert.ifError(err);
assert.strictEqual(Object.keys(data).length, 7);
assert.strictEqual(data[key1], null);
assert.strictEqual(
util.format('%d %d', 1180591620717411303424n, 12345678901234567890123n),
'1180591620717411303424n 12345678901234567890123n'
);
// Integer format specifier
assert.strictEqual(util.format('%i'), '%i');
assert.strictEqual(util.format('%i', 42.0), '42');
assert.strictEqual(util.format('%i', 42), '42');
assert.strictEqual(util.format('%i', '42'), '42');
assert.strictEqual(util.format('%i', '42.0'), '42');
assert.strictEqual(util.format('%i', 1.5), '1');
assert.strictEqual(util.format('%i', -0.5), '0');
assert.strictEqual(util.format('%i', ''), 'NaN');
assert.strictEqual(util.format('%i %i', 42, 43), '42 43');
assert.strictEqual(util.format('%i %i', 42), '42 %i');
assert.strictEqual(
util.format('%i', 1180591620717411303424),
'1'
);
assert.strictEqual(
util.format('%i', 1180591620717411303424n),
'1180591620717411303424n'
);
assert.strictEqual(
util.format('%i %i', 1180591620717411303424n, 12345678901234567890123n),
'1180591620717411303424n 12345678901234567890123n'
);
assert.strictEqual(
util.format('%d %i', 1180591620717411303424n, 12345678901234567890123n),
'1180591620717411303424n 12345678901234567890123n'
it('should localize the name', function() {
assert.strictEqual(autoscaler.name, AUTOSCALER_NAME);
});
function assertSpanAttributes (
span: Span, httpStatusCode: number, httpMethod: string, hostName: string,
path: string, userAgent?: string) {
assert.strictEqual(
span.status.code, Http2Plugin.convertTraceStatus(httpStatusCode))
assert.strictEqual(
span.attributes[Http2Plugin.ATTRIBUTE_HTTP_HOST], hostName)
assert.strictEqual(
span.attributes[Http2Plugin.ATTRIBUTE_HTTP_METHOD], httpMethod)
assert.strictEqual(span.attributes[Http2Plugin.ATTRIBUTE_HTTP_PATH], path)
assert.strictEqual(span.attributes[Http2Plugin.ATTRIBUTE_HTTP_ROUTE], path)
assert.strictEqual(
span.attributes[Http2Plugin.ATTRIBUTE_HTTP_USER_AGENT], userAgent)
assert.strictEqual(
span.attributes[Http2Plugin.ATTRIBUTE_HTTP_STATUS_CODE],
`${httpStatusCode}`)
}
assert.strictEqual(iterator.next().value, 'world');
assert.strictEqual(iterator.next().value, 'hello');
assert.strictEqual(iterator.next().done, true);
assert.deepStrictEqual([...map.values()], ['hello', 'world', 'hello']);
map = new MultiMap();
map.set('one', 'hello');
map.set('one', 'world');
map.set('two', 'hello');
iterator = map.values();
assert.strictEqual(iterator.next().value, 'hello');
assert.strictEqual(iterator.next().value, 'world');
assert.strictEqual(iterator.next().value, 'hello');
assert.strictEqual(iterator.next().done, true);
assert.deepStrictEqual([...map.values()], ['hello', 'world', 'hello']);
});
module.exports = async function testCloudSync(engine) {
const platform = engine.platform;
const prefs = platform.getSharedPreferences(platform);
const tierManager = engine._tiers;
assert.strictEqual(tierManager.ownTier, 'desktop');
assert.strictEqual(tierManager.ownIdentity.length, 17);
assert(tierManager.ownAddress.startsWith('desktop:'));
const self = engine.devices.getDevice('thingengine-own-' + tierManager.ownAddress);
assert(self);
assert.strictEqual(self.tier, 'desktop');
assert.strictEqual(self.identity, tierManager.ownIdentity);
assert.strictEqual(self.address, tierManager.ownAddress);
assert.strictEqual(prefs.get('cloud-id'), undefined);
assert(!tierManager.isConnected('cloud'));
engine.setCloudId(TEST_CLOUD_ID, TEST_AUTH_TOKEN);
assert(tierManager.isConnected('cloud'));
.on('finish', function () {
var response = renderingContext
.routingContext.middleware.response;
assert.strictEqual(renderingContext.isCanceled, false);
assert.strictEqual(response.result, content);
assert.strictEqual(response.status, 200);
assert.strictEqual(
Object.keys(response.setHeaders).length, 2
);
assert.strictEqual(
typeof(response.setHeaders['Content-Type']), 'string'
);
assert.strictEqual(
typeof(response.setHeaders['X-Powered-By']), 'string'
);
done();
});
});
result.forEach(function(ip) {
if (isIPv4(ip.address))
assert.strictEqual(ip.family, 4);
else if (isIPv6(ip.address))
assert.strictEqual(ip.family, 6);
else
assert.fail('unexpected IP address');
});
}
it("rounds 04 to 05", function () {
assert.strictEqual(money.roundTo5Cents("2.04"), "2.05");
});