TypeScript!
This commit is contained in:
1 parent
ee8c43747e
commit
5d3c81cb23
105 files changed
+12054
-1901
No files matched your search
@@ -1,7 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
import ava from "ava";
|
||||
import * as common from "../lib/common.js";
|
||||
import * as common from "../lib/common";
|
||||
import { ParamPath } from "../lib/types";
|
||||
|
||||
ava("typeOf", t => {
|
||||
const cases = [
|
||||
@@ -65,24 +64,24 @@ ava("generateDeviceId", t => {
|
||||
});
|
||||
|
||||
ava("parsePath", t => {
|
||||
const case1 = ["Seg1.Seg2.Seg3", ["Seg1", "Seg2", "Seg3"]];
|
||||
const case1 = ["Seg1.Seg2.Seg3", ["Seg1", "Seg2", "Seg3"]] as ParamPath;
|
||||
case1[1].alias = 0;
|
||||
case1[1].wildcard = 0;
|
||||
|
||||
const case2 = ["Seg1.*.*.Seg4", ["Seg1", "*", "*", "Seg4"]];
|
||||
const case2 = ["Seg1.*.*.Seg4", ["Seg1", "*", "*", "Seg4"]] as ParamPath;
|
||||
case2[1].alias = 0;
|
||||
case2[1].wildcard = 6;
|
||||
|
||||
const case3 = [
|
||||
"Seg1.Seg2.[Seg6:Seg9].Seg3",
|
||||
["Seg1", "Seg2", [["Seg6"], "Seg9"], "Seg3"]
|
||||
];
|
||||
] as ParamPath;
|
||||
case3[1].alias = 4;
|
||||
case3[1].wildcard = 0;
|
||||
case3[1][2][0].alias = 0;
|
||||
case3[1][2][0].wildcard = 0;
|
||||
|
||||
const case4 = ["Seg1.[*:SegAny]", ["Seg1", [["*"], "SegAny"]]];
|
||||
const case4 = ["Seg1.[*:SegAny]", ["Seg1", [["*"], "SegAny"]]] as ParamPath;
|
||||
case4[1].alias = 2;
|
||||
case4[1].wildcard = 0;
|
||||
case4[1][1][0].alias = 0;
|
||||
@@ -93,24 +92,33 @@ ava("parsePath", t => {
|
||||
});
|
||||
|
||||
ava("addPathMeta", t => {
|
||||
const case1 = [["Seg1", "Seg2", "Seg3"], ["Seg1", "Seg2", "Seg3"]];
|
||||
const case1 = [
|
||||
["Seg1", "Seg2", "Seg3"],
|
||||
["Seg1", "Seg2", "Seg3"]
|
||||
] as ParamPath;
|
||||
case1[1].alias = 0;
|
||||
case1[1].wildcard = 0;
|
||||
|
||||
const case2 = [["Seg1", "*", "*", "Seg4"], ["Seg1", "*", "*", "Seg4"]];
|
||||
const case2 = [
|
||||
["Seg1", "*", "*", "Seg4"],
|
||||
["Seg1", "*", "*", "Seg4"]
|
||||
] as ParamPath;
|
||||
case2[1].alias = 0;
|
||||
case2[1].wildcard = 6;
|
||||
|
||||
const case3 = [
|
||||
["Seg1", "Seg2", [["Seg6"], "Seg9"], "Seg3"],
|
||||
["Seg1", "Seg2", [["Seg6"], "Seg9"], "Seg3"]
|
||||
];
|
||||
] as ParamPath;
|
||||
case3[1].alias = 4;
|
||||
case3[1].wildcard = 0;
|
||||
case3[1][2][0].alias = 0;
|
||||
case3[1][2][0].wildcard = 0;
|
||||
|
||||
const case4 = [["Seg1", [["*"], "SegAny"]], ["Seg1", [["*"], "SegAny"]]];
|
||||
const case4 = [
|
||||
["Seg1", [["*"], "SegAny"]],
|
||||
["Seg1", [["*"], "SegAny"]]
|
||||
] as ParamPath;
|
||||
case4[1].alias = 2;
|
||||
case4[1].wildcard = 0;
|
||||
case4[1][1][0].alias = 0;
|
||||
Reference in new issue
Block a user