Skip to content

Commit

Permalink
πŸ‘¨β€πŸ”¬ Add test cases covering #93
Browse files Browse the repository at this point in the history
Thanks to @zeearth
  • Loading branch information
dr-dimitru committed Jun 17, 2022
1 parent 887e833 commit 67c7661
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
5 changes: 2 additions & 3 deletions test/client/router.core.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { _ } from 'meteor/underscore';
import { check } from 'meteor/check';
import { GetSub } from './_helpers.js';
import { Meteor } from 'meteor/meteor';
import { Random } from 'meteor/random';
Expand Down Expand Up @@ -176,9 +175,9 @@ Tinytest.addAsync('Client - Router - define and go to route with UTF-8 fields',
});

Tinytest.addAsync('Client - Router - parse params and query', (test, next) => {
const rand = Random.id();
const rand = Random.id();
let rendered = 0;
let params = {}
let params = {};

FlowRouter.route('/' + rand + '/:foo', {
action(_params) {
Expand Down
24 changes: 24 additions & 0 deletions test/common/router.path.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,30 @@ Tinytest.add('Common - Router - path - optional last param missing', function (t
test.equal(path, expectedPath);
});

Tinytest.add('Common - Router - path - both optional last param missing', function (test) {
var pathDef = "/blog/:id?/:action?";
var fields = {
id: "6135cb32d14df059605901fd",
action: ''
};
var expectedPath = "/blog/6135cb32d14df059605901fd";

var path = FlowRouter.path(pathDef, fields);
test.equal(path, expectedPath);
});

Tinytest.add('Common - Router - path - both optional last param exists', function (test) {
var pathDef = "/blog/:id?/:action?";
var fields = {
id: "6135cb32d14df059605901fd",
action: 'view'
};
var expectedPath = "/blog/6135cb32d14df059605901fd/view";

var path = FlowRouter.path(pathDef, fields);
test.equal(path, expectedPath);
});

Tinytest.add('Common - Router - path - optional last param exists', function (test) {
var pathDef = "/blog/:blogId/some/:name?";
var fields = {
Expand Down

0 comments on commit 67c7661

Please sign in to comment.