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
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 8 additions & 0 deletions client/__tests__/loader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
describe('Loader', () => {
context('Client', () => {
it('should load page.js', () => {
expect(!!FlowRouter._page).to.be.equal(true);
expect(!!window.page).to.be.equal(false);
});
});
});
13 changes: 13 additions & 0 deletions lib/__tests__/group.core.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
describe('Group', () => {
const router = new Router();

context('Common', () => {
context('Class', () => {
it('should be an extension of the SharedGroup', () => {
const group = new Group(router);
expect(group).to.be.an.instanceof(Group);
expect(group).to.be.an.instanceof(SharedGroup);
});
});
});
});
61 changes: 0 additions & 61 deletions lib/__tests__/group.js

This file was deleted.

76 changes: 76 additions & 0 deletions lib/__tests__/group.method.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
const catchable = (done, fn) => {
try {
fn();
} catch (e) {
done(e);
}
};

describe('Group', () => {
const router = new Router();
context('Common', () => {
context('Methods', () => {
it('should set and retrieve group name', done => {
const rand = Random.id(),
name = Random.id(),
group = new Group(router, {name}),
timer = setTimeout(Meteor.bindEnvironment(() => {done();}), 50);

group.route(`/${rand}`, {
action() {
expect(router.current().route.group.name).to.be.equal(name);
clearTimeout(timer);
done();
}
});

router.go(`/${rand}`);
});

context('Route', () => {
const prefix = Random.id(),
rand = Random.id();

it('should work with prefix', done => {
const group = new Group(router, {prefix: `/${prefix}`});
let rendered = 0;

group.route(`/${rand}`, {
action: function() {
rendered++;
}
});

router.go(`/${prefix}/${rand}`);

Meteor.setTimeout(() => {
catchable(done, () => {
if (Meteor.isClient) expect(rendered).to.be.equal(1);
done();
});
}, 50);
});

it('should work without prefix', done => {
const group = new Group(router);
let rendered = 0;

group.route(`/${rand}`, {
action() {
rendered++;
}
});

router.go(`/${rand}`);

Meteor.setTimeout(() => {
catchable(done, () => {
if (Meteor.isClient) expect(rendered).to.be.equal(1);
done();
});
}, 50);
});
});
});
});
});
11 changes: 11 additions & 0 deletions lib/__tests__/loader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
describe('Loader', () => {
context('Common', () => {
it('should create FlowRouter', () => {
expect(!!FlowRouter).to.be.equal(true);
});

it('should load query.js', () => {
expect(!!FlowRouter._qs).to.be.equal(true);
});
});
});
12 changes: 12 additions & 0 deletions lib/__tests__/router.core.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
describe('Route', () => {
const router = new Router();

context('Common', () => {
context('Class', () => {
it('should be an extension of the SharedRouter', () => {
expect(router).to.be.an.instanceof(Router);
expect(router).to.be.an.instanceof(SharedRouter);
});
});
});
});
Loading