Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stuck at Idempotent Routing -> new ES2015 BDD style test cases failing while old Tinytest cases works (now on right branch) #456

Open
wants to merge 7 commits into
base: ssr
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
added setParams should work generally
  • Loading branch information
tjmonsi committed Dec 17, 2015
commit 20cfb42d09adb0ac4773245defcc7dd35e0e089b
40 changes: 39 additions & 1 deletion lib/__tests__/router.method.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ describe('Router', () => {
it('should get current route path', done => {
const value = Random.id(),
rand = Random.id(),
pathDef = `${rand}/:_id`,
pathDef = `/${rand}/:_id`,
path = `/${rand}/${value}`;
let detectedValue = null;

Expand All @@ -137,6 +137,44 @@ describe('Router', () => {
}, 50);
});
});

context('setParams', () => {
it('should work generally', done => {
const randomKey = Random.id(),
pathDef = `/${randomKey}/:cat/:id`,
paramsList = [];

router.route(pathDef, {
action: function(params) {
paramsList.push(params);
}
});

router.go(pathDef, {cat: 'meteor', id: '200'});

Meteor.setTimeout(() => {
catchable(done, () => {
if (Meteor.isClient) {
const success = router.setParams({id: '700'});
expect(success).to.be.equal(true);
Meteor.setTimeout(() => {
catchable(done, validate);
}, 50);
}
else done();
});
}, 50);

function validate() {
expect(paramsList).to.have.a.lengthOf(2);
expect(paramsList[0]).to.have.a.property('cat', 'meteor');
expect(paramsList[0]).to.have.a.property('id', '200');
expect(paramsList[1]).to.have.a.property('cat', 'meteor');
expect(paramsList[1]).to.have.a.property('id', '700');
done();
}
});
});
});
});
});