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 merge two rings on a join event", function () {
var data = gossip.decodeJob(Buffer.from(JSON.stringify({
event: "ring",
data: {
type: "join",
actor: "foo",
vclock: vclock.toJSON(true),
data: chash.toJSON(true),
round: 0
}
})));
sinon.spy(gossip, "_joinNewRing");
gossip._mergeRings(data.data);
assert(gossip._joinNewRing.called);
gossip._joinNewRing.restore();
});
browser.visit('/', function() {
assert.ok(browser.success);
var item = browser.query('.lang-picker span');
assert(!!item, 'There should be current language indicator');
var prevLanguage = item.textContent;
item = browser.query('.lang-picker a');
assert(!!item, 'There should be language switcher');
var requestedLanguage = item.textContent;
browser.visit(item.getAttribute('href'), function() {
assert.ok(browser.success);
var item = browser.query('.lang-picker span');
assert(!!item, 'There should be current language indicator');
var newLanguage = item.textContent;
assert(prevLanguage != newLanguage,
'New language should be different from previous');
assert(requestedLanguage == newLanguage,
'New language should be the one that we requested');
done();
});
});
});
return function (ms) {
var t1 = Date.now()
var delta = t1 - t0
assert(delta < ms + 5, 'It took more than ' + ms + ' ms')
assert(delta > ms - 5, 'It took less than ' + ms + ' ms')
}
}
}
handleReplaceList(x) {
this.setState(this.state.set('list', Immutable.fromJS(x).toList()))
}
}
const store = alt.createStore(ImmutableStore, 'ImmutableStore')
assert(store.getState().get('bar') === 'hello', 'bar is initially `hello`')
assert(store.getState().get('map').count() === 0, 'map is initially zero')
assert(store.getState().get('list').count() === 0, 'list is initially zero')
actions.replaceMap({a: 1, b: 2})
assert(store.getState().get('bar') === 'hello', 'bar is still `hello` after replacing map')
assert(store.getState().get('list').count() === 0, 'list still has zero items after replacing map')
assert(store.getState().get('map').count() === 2, 'map has 2 items in it now after replacing map')
actions.replaceList([1, 2, 3, 4])
assert(store.getState().get('bar') === 'hello', 'bar is still `hello` after replacing list')
assert(store.getState().get('list').count() === 4, 'list has 4 items now after replacing list')
assert(store.getState().get('map').count() === 2, 'map still has 2 items in it after replacing list')
actions.updateBar('world')
assert(store.getState().get('bar') === 'world', 'bar is now `world` after updating bar')
assert(store.getState().get('list').count() === 4, 'list still has 4 items after updating bar')
assert(store.getState().get('map').count() === 2, 'map still has 2 items in it after updating bar')
},
kubectl.node.list(function(err, data){
assert(!err && data)
done(err)
})
})
'snapshotting'() {
myActions.updateName('bear')
const snapshot = alt.takeSnapshot()
assert.isString(snapshot, 'a snapshot json is returned')
assert(JSON.parse(snapshot).MyStore.name === 'bear', 'the state is current')
assert.isObject(JSON.parse(snapshot).AltSecondStore, 'the custom identifier name works')
myActions.updateName('blossom')
assert(myStore.getState().name === 'blossom', 'action was called, state was updated properly')
assert(JSON.parse(snapshot).MyStore.name === 'bear', 'the snapshot is not affected by action')
},
function fail(msg: string) {
chai.assert(false, msg);
}
return new Map(List(inputsToBuild.values()).map((val) => {
const fn = val.get('filename')
assert(val.get('source'), `${fn} contains null source`)
return [ val.get('filename'), { content: val.get('source') } ]
}))
}
"It doesn't look like you are declaring `private _albumUrl` keyword and assigning the contents of the `album.json` file to it."
);
const albumJsonFile = tsquery(
ast,
"PropertyDeclaration StringLiteral[value='../assets/album.json']"
);
assert(
albumJsonFile.length > 0,
"It doesn't look like you are declaring `private _albumUrl` keyword and assigning the contents of the `album.json` file to it."
);
const getAlbumMethod = tsquery(ast, 'Identifier[name="getAlbum"]');
assert(
getAlbumMethod.length > 0,
"The ProductService doesn't have a method named `getAlbum()` yet."
);
const returnStatement = tsquery(
ast,
"MethodDeclaration:has(Identifier[name=getAlbum]) ReturnStatement"
);
assert(
returnStatement.length > 0,
"The `getAlbum()` doesn't have a `return` statement yet."
);
const thisStatement = tsquery(
ast,