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 track a promise's callbacks", function () {
var promises = new PromiseStore();
// There should be no tracked promises.
assert.lengthOf(promises, 0);
// Add one promise.
new Promise(function (resolve, reject) {
promises.make(randomToken(), resolve, reject);
});
assert.lengthOf(promises, 1);
});
it(`Child validations do not apply when validating the parent class`, function () {
class ParentClass {
@Min(10)
foo! : number;
}
class ChildClass extends ParentClass {
@Min(10)
bar! : number;
}
const instance = new ParentClass();
const result = isInvalid(validator, instance);
assert.lengthOf(result.error.details, 1);
});
it('properly parses a git-annex remote metadata file', () => {
const resp = 'timestamp remoteuuid:commitinfo xversionId#fileName'
const remotesInfo = remoteFiles.processRemoteMetadata(resp)
assert.lengthOf(remotesInfo, 1)
const remoteObj = remotesInfo[0]
expect(remoteObj).toHaveProperty('timestamp')
expect(remoteObj.timestamp).toEqual('timestamp')
expect(remoteObj).toHaveProperty('remoteUuid')
expect(remoteObj.remoteUuid).toEqual('remoteuuid')
expect(remoteObj).toHaveProperty('fileName')
expect(remoteObj.fileName).toEqual('fileName')
expect(remoteObj).toHaveProperty('versionId')
expect(remoteObj.versionId).toEqual('versionId')
})
it('returns an empty array if there is an improperly formatted metadata file', () => {
let args = log.info.args[0];
assert.lengthOf(args, 2);
assert.equal(args[0], 'emailEvent');
assert.deepEqual(args[1], {
complaint: true,
domain: 'other',
flow_id: 'wibble',
locale: 'fr',
template: 'blee',
templateVersion: '',
type: 'bounced'
});
args = log.info.args[1];
assert.lengthOf(args, 2);
assert.equal(args[0], 'emailEvent');
assert.deepEqual(args[1], {
complaint: true,
domain: 'gmail.com',
flow_id: 'wibble',
locale: 'fr',
template: 'blee',
templateVersion: '',
type: 'bounced'
});
});
watcher.onAdded.connect(nodes=>{
assert.equal(div1,nodes[0]);
assert.equal(div2,nodes[1]);
assert.lengthOf(nodes,2);
});
watcher.onRemoved.connect(nodes=>{
.then(function(resArray){
assert.typeOf(resArray, 'array');
assert.lengthOf(resArray, 2);
return new BlockKlass(testChainId).select('COUNT(id)').fire();
})
.then(function(res){
.then(result => assert.lengthOf(result, 0));
});
it('Renders all actions', () => {
instance.renderActions(getActions(), pos);
const nodes = document.body.querySelectorAll('paper-listbox paper-item');
assert.lengthOf(nodes, 2);
});
const tree = selectLocalityTree(state);
assert.isEmpty(tree.tiers);
assert.isEmpty(tree.nodes);
assert.hasAllKeys(tree.localities, ["region"]);
const regions = tree.localities.region;
assert.hasAllKeys(regions, ["us-east-1", "us-east-2"]);
const usEast1 = regions["us-east-1"];
assert.isEmpty(usEast1.localities);
assert.deepEqual(usEast1.tiers, [{ key: "region", value: "us-east-1" }]);
assert.lengthOf(usEast1.nodes, 1);
const usEast2 = regions["us-east-2"];
assert.isEmpty(usEast2.localities);
assert.deepEqual(usEast2.tiers, [{ key: "region", value: "us-east-2" }]);
assert.lengthOf(usEast2.nodes, 1);
});
});
.then((result) => {
assert.lengthOf(
fetchMock.calls(`${api.API_PREFIX}/databases/${dbName}`),
1,
);
assert.lengthOf(result.table_names, 2);
assert.lengthOf(result.grants, 2);
});
});