/
links.json
118 lines (116 loc) · 3.02 KB
/
links.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
{
"example-of-test-cases": {
"comment": "
How to read this test data:
* By default href is the input, and expected is the output.
* Other data values can be template parameters.
* inheritProperties tells the engine to look for values in also in the parent.
* The use-attr value can change the href to another name, like uri.
* The nested-query value can be used to find a link object buried beneath the current one.
See https://github.com/GistLabs/mechanize/wiki/JSON-Linking for more details.
",
"href": "",
"use-attr": "href",
"rel": "",
"expected": ""
},
"simple": {
"href": "http://example.com",
"rel": "self",
"expected": "http://example.com"
},
"use-uri": {
"uri": "http://example.com",
"use-attr": "uri",
"rel": "self",
"expected": "http://example.com"
},
"relative": {
"href": "bar",
"baseUrl": "http://example.com/foo/",
"expected": "http://example.com/foo/bar"
},
"trivial-template": {
"href": "http://example.com/{a}",
"a": "foo",
"expected": "http://example.com/foo"
},
"template-path-segments" : {
"href": "http://example.com{/a,b}/baz",
"a": "foo",
"b": "bar",
"expected": "http://example.com/foo/bar/baz"
},
"relative-path-segments" : {
"href": ".{/a,b}/baz",
"a": "foo",
"b": "bar",
"expected": "./foo/bar/baz"
},
"template-form-style" : {
"href": "http://example.com{?a,b}",
"a": "foo",
"b": "bar",
"expected": "http://example.com?a=foo&b=bar"
},
"template-list" : {
"href": "http://example.com{/list*}",
"list": ["a", "b", "c"],
"expected": "http://example.com/a/b/c"
},
"template-keys" : {
"href": "http://example.com{?keys*}",
"keys": { "a": "1", "b": "2" },
"expected": "http://example.com?a=1&b=2"
},
"template-keys-order" : {
"href": "http://example.com{?keys*}",
"keys": { "b": "2", "a": "1" },
"expected": "http://example.com?a=1&b=2",
"comment": "Decided to always sort the keys... made testing easier but may need to revisit"
},
"template-keys-and-keys2" : {
"href": "http://example.com{?keys*,keys2*}",
"keys": { "b": "2", "a": "1" },
"keys2": { "x": "3", "y": "4"},
"expected": "http://example.com?a=1&b=2&x=3&y=4",
},
"template-complex" : {
"href": "http://example.com{/list*}{?keys*,keys2*}",
"list": ["a", "b", "c"],
"keys": { "b": "2", "a": "1" },
"keys2": { "x": "3", "y": "4"},
"expected": "http://example.com/a/b/c?a=1&b=2&x=3&y=4",
},
"nested-search-up-into-parent" : {
"nested-query": "link",
"a": "foo",
"link": {
"href": "http://example.com/{a}",
"inheritProperties": "",
"expected": "http://example.com/foo"
}
},
"nested-search-local-over-parent" : {
"nested-query": "link",
"a": "foo",
"link": {
"href": "http://example.com/{a}",
"a": "bar",
"inheritProperties": "",
"expected": "http://example.com/bar"
}
},
"nested-search-up-into-grandparent" : {
"nested-query": "link",
"a": "foo",
"parent": {
"inheritProperties": "",
"link": {
"href": "http://example.com/{a}",
"inheritProperties": "",
"expected": "http://example.com/foo"
}
}
}
}