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 load path url if initial state is null and stores as router lastLoadedState as Json', function(done) {
var stub = sinon.stub(RequestScreen.prototype, 'load', function() {
return '{"sentinel":true}';
});
var router = new Router({
path: '/path',
component: CustomComponent
});
var screen = new Router.defaultScreen(router);
screen.load('/path').then(() => {
assert.deepEqual({
sentinel: true
}, screen.maybeParseLastLoadedStateAsJson());
assert.strictEqual(1, RequestScreen.prototype.load.callCount);
router.dispose();
stub.restore();
done();
});
it('should load path url if initial state is null and stores as router lastLoadedState', function(done) {
var stub = sinon.stub(RequestScreen.prototype, 'load', function() {
return 'sentinel';
});
var router = new Router({
path: '/path',
component: CustomComponent
});
var screen = new Router.defaultScreen(router);
screen.load('/path').then(() => {
assert.strictEqual('sentinel', router.lastLoadedState);
assert.strictEqual(1, RequestScreen.prototype.load.callCount);
router.dispose();
stub.restore();
done();
});
});