mirror of
https://github.com/wekan/wekan.git
synced 2025-09-22 01:50:48 +02:00
Include to Wekan packages directory contents, so that meteor command would build all directly.
This also simplifies build scripts. Thanks to xet7 !
This commit is contained in:
parent
6117097a93
commit
73e265d8fd
354 changed files with 36977 additions and 106 deletions
135
packages/kadira-flow-router/test/common/router.path.spec.js
Normal file
135
packages/kadira-flow-router/test/common/router.path.spec.js
Normal file
|
@ -0,0 +1,135 @@
|
|||
Router = FlowRouter.Router;
|
||||
|
||||
Tinytest.addAsync('Common - Router - validate path definition', function (test, next) {
|
||||
// path must start with '/'
|
||||
try {
|
||||
FlowRouter.route(Random.id());
|
||||
} catch(ex) {
|
||||
next();
|
||||
}
|
||||
});
|
||||
|
||||
Tinytest.add('Common - Router - path - generic', function (test) {
|
||||
var pathDef = "/blog/:blogId/some/:name";
|
||||
var fields = {
|
||||
blogId: "1001",
|
||||
name: "superb"
|
||||
};
|
||||
var expectedPath = "/blog/1001/some/superb";
|
||||
|
||||
var path = FlowRouter.path(pathDef, fields);
|
||||
test.equal(path, expectedPath);
|
||||
});
|
||||
|
||||
Tinytest.add('Common - Router - path - queryParams', function (test) {
|
||||
var pathDef = "/blog/:blogId/some/:name";
|
||||
var fields = {
|
||||
blogId: "1001",
|
||||
name: "superb"
|
||||
};
|
||||
|
||||
var queryParams = {
|
||||
aa: "100",
|
||||
bb: "200"
|
||||
};
|
||||
|
||||
var expectedPath = "/blog/1001/some/superb?aa=100&bb=200";
|
||||
|
||||
var path = FlowRouter.path(pathDef, fields, queryParams);
|
||||
test.equal(path, expectedPath);
|
||||
});
|
||||
|
||||
Tinytest.add('Common - Router - path - just queryParams', function (test) {
|
||||
var pathDef = "/blog/abc";
|
||||
var queryParams = {
|
||||
aa: "100",
|
||||
bb: "200"
|
||||
};
|
||||
|
||||
var expectedPath = "/blog/abc?aa=100&bb=200";
|
||||
|
||||
var path = FlowRouter.path(pathDef, null, queryParams);
|
||||
test.equal(path, expectedPath);
|
||||
});
|
||||
|
||||
|
||||
Tinytest.add('Common - Router - path - missing fields', function (test) {
|
||||
var pathDef = "/blog/:blogId/some/:name";
|
||||
var fields = {
|
||||
blogId: "1001",
|
||||
};
|
||||
var expectedPath = "/blog/1001/some";
|
||||
|
||||
var path = FlowRouter.path(pathDef, fields);
|
||||
test.equal(path, expectedPath);
|
||||
});
|
||||
|
||||
Tinytest.add('Common - Router - path - no fields', function (test) {
|
||||
var pathDef = "/blog/blogId/some/name";
|
||||
var path = FlowRouter.path(pathDef);
|
||||
test.equal(path, pathDef);
|
||||
});
|
||||
|
||||
Tinytest.add('Common - Router - path - complex route', function (test) {
|
||||
var pathDef = "/blog/:blogId/some/:name(\\d*)+";
|
||||
var fields = {
|
||||
blogId: "1001",
|
||||
name: 20
|
||||
};
|
||||
var expectedPath = "/blog/1001/some/20";
|
||||
|
||||
var path = FlowRouter.path(pathDef, fields);
|
||||
test.equal(path, expectedPath);
|
||||
});
|
||||
|
||||
Tinytest.add('Common - Router - path - optional last param missing', function (test) {
|
||||
var pathDef = "/blog/:blogId/some/:name?";
|
||||
var fields = {
|
||||
blogId: "1001"
|
||||
};
|
||||
var expectedPath = "/blog/1001/some";
|
||||
|
||||
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 = {
|
||||
blogId: "1001",
|
||||
name: 20
|
||||
};
|
||||
var expectedPath = "/blog/1001/some/20";
|
||||
|
||||
var path = FlowRouter.path(pathDef, fields);
|
||||
test.equal(path, expectedPath);
|
||||
});
|
||||
|
||||
Tinytest.add('Common - Router - path - remove trailing slashes', function (test) {
|
||||
var pathDef = "/blog/:blogId/some/:name//";
|
||||
var fields = {
|
||||
blogId: "1001",
|
||||
name: "superb"
|
||||
};
|
||||
var expectedPath = "/blog/1001/some/superb";
|
||||
|
||||
var path = FlowRouter.path(pathDef, fields);
|
||||
test.equal(path, expectedPath);
|
||||
});
|
||||
|
||||
Tinytest.add('Common - Router - path - handle multiple slashes', function (test) {
|
||||
var pathDef = "/blog///some/hi////";
|
||||
var expectedPath = "/blog/some/hi";
|
||||
|
||||
var path = FlowRouter.path(pathDef);
|
||||
test.equal(path, expectedPath);
|
||||
});
|
||||
|
||||
Tinytest.add('Common - Router - path - keep the root slash', function (test) {
|
||||
var pathDef = "/";
|
||||
var fields = {};
|
||||
var expectedPath = "/";
|
||||
|
||||
var path = FlowRouter.path(pathDef, fields);
|
||||
test.equal(path, expectedPath);
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue