Debian Codegraph @

t/purl/types/npm-test.json

raw
1 {
2 "$schema": "https://packageurl.org/schemas/purl-test.schema-0.1.json",
3 "tests": [
4 {
5 "description": "npm can be scoped. Roundtrip an input purl to canonical.",
6 "test_group": "advanced",
7 "test_type": "roundtrip",
8 "input": "pkg:npm/%40angular/[email protected]",
9 "expected_output": "pkg:npm/%40angular/[email protected]",
10 "expected_failure": false,
11 "expected_failure_reason": null
12 },
13 {
14 "description": "npm can be scoped",
15 "test_group": "base",
16 "test_type": "parse",
17 "input": "pkg:npm/%40angular/[email protected]",
18 "expected_output": {
19 "type": "npm",
20 "namespace": "@angular",
21 "name": "animation",
22 "version": "12.3.1",
23 "qualifiers": null,
24 "subpath": null
25 },
26 "expected_failure": false,
27 "expected_failure_reason": null
28 },
29 {
30 "description": "npm can be scoped. Roundtrip a canonical input to canonical output.",
31 "test_group": "base",
32 "test_type": "roundtrip",
33 "input": "pkg:npm/%40angular/[email protected]",
34 "expected_output": "pkg:npm/%40angular/[email protected]",
35 "expected_failure": false,
36 "expected_failure_reason": null
37 },
38 {
39 "description": "npm can be scoped",
40 "test_group": "base",
41 "test_type": "build",
42 "input": {
43 "type": "npm",
44 "namespace": "@angular",
45 "name": "animation",
46 "version": "12.3.1",
47 "qualifiers": null,
48 "subpath": null
49 },
50 "expected_output": "pkg:npm/%40angular/[email protected]",
51 "expected_failure": false,
52 "expected_failure_reason": null
53 },
54 {
55 "description": "Parse test for PURL type: npm",
56 "test_group": "base",
57 "test_type": "parse",
58 "input": "pkg:npm/[email protected]",
59 "expected_output": {
60 "type": "npm",
61 "namespace": null,
62 "name": "foobar",
63 "version": "12.3.1",
64 "qualifiers": null,
65 "subpath": null
66 },
67 "expected_failure": false,
68 "expected_failure_reason": null
69 },
70 {
71 "description": "Roundtrip test for PURL type: npm",
72 "test_group": "base",
73 "test_type": "roundtrip",
74 "input": "pkg:npm/[email protected]",
75 "expected_output": "pkg:npm/[email protected]",
76 "expected_failure": false,
77 "expected_failure_reason": null
78 },
79 {
80 "description": "Build test for PURL type: npm",
81 "test_group": "base",
82 "test_type": "build",
83 "input": {
84 "type": "npm",
85 "namespace": null,
86 "name": "foobar",
87 "version": "12.3.1",
88 "qualifiers": null,
89 "subpath": null
90 },
91 "expected_output": "pkg:npm/[email protected]",
92 "expected_failure": false,
93 "expected_failure_reason": null
94 },
95 {
96 "description": "Parse test for PURL type: npm",
97 "test_group": "base",
98 "test_type": "parse",
99 "input": "pkg:npm/%40angular/[email protected]",
100 "expected_output": {
101 "type": "npm",
102 "namespace": "@angular",
103 "name": "animation",
104 "version": "12.3.1",
105 "qualifiers": null,
106 "subpath": null
107 },
108 "expected_failure": false,
109 "expected_failure_reason": null
110 },
111 {
112 "description": "Roundtrip test for PURL type: npm",
113 "test_group": "base",
114 "test_type": "roundtrip",
115 "input": "pkg:npm/%40angular/[email protected]",
116 "expected_output": "pkg:npm/%40angular/[email protected]",
117 "expected_failure": false,
118 "expected_failure_reason": null
119 },
120 {
121 "description": "Build test for PURL type: npm",
122 "test_group": "base",
123 "test_type": "build",
124 "input": {
125 "type": "npm",
126 "namespace": "@angular",
127 "name": "animation",
128 "version": "12.3.1",
129 "qualifiers": null,
130 "subpath": null
131 },
132 "expected_output": "pkg:npm/%40angular/[email protected]",
133 "expected_failure": false,
134 "expected_failure_reason": null
135 },
136 {
137 "description": "Parse test for PURL type: npm",
138 "test_group": "base",
139 "test_type": "parse",
140 "input": "pkg:npm/[email protected]?vcs_url=git://host.com/path/to/repo.git%404345abcd34343",
141 "expected_output": {
142 "type": "npm",
143 "namespace": null,
144 "name": "mypackage",
145 "version": "12.4.5",
146 "qualifiers": {
147 "vcs_url": "git://host.com/path/to/repo.git@4345abcd34343"
148 },
149 "subpath": null
150 },
151 "expected_failure": false,
152 "expected_failure_reason": null
153 },
154 {
155 "description": "Roundtrip test for PURL type: npm",
156 "test_group": "base",
157 "test_type": "roundtrip",
158 "input": "pkg:npm/[email protected]?vcs_url=git://host.com/path/to/repo.git%404345abcd34343",
159 "expected_output": "pkg:npm/[email protected]?vcs_url=git:%2F%2Fhost.com%2Fpath%2Fto%2Frepo.git%404345abcd34343",
160 "expected_failure": false,
161 "expected_failure_reason": null
162 },
163 {
164 "description": "Build test for PURL type: npm",
165 "test_group": "base",
166 "test_type": "build",
167 "input": {
168 "type": "npm",
169 "namespace": null,
170 "name": "mypackage",
171 "version": "12.4.5",
172 "qualifiers": {
173 "vcs_url": "git://host.com/path/to/repo.git@4345abcd34343"
174 },
175 "subpath": null
176 },
177 "expected_output": "pkg:npm/[email protected]?vcs_url=git:%2F%2Fhost.com%2Fpath%2Fto%2Frepo.git%404345abcd34343",
178 "expected_failure": false,
179 "expected_failure_reason": null
180 },
181 {
182 "description": "valid npm purl without version and with subpath, scope unencoded",
183 "test_group": "advanced",
184 "test_type": "roundtrip",
185 "input": "pkg:npm/@babel/core#/googleapis/api/annotations/",
186 "expected_output": "pkg:npm/%40babel/core#googleapis/api/annotations",
187 "expected_failure": false,
188 "expected_failure_reason": null
189 },
190 {
191 "description": "valid npm purl without version and with subpath, scope unencoded",
192 "test_group": "advanced",
193 "test_type": "parse",
194 "input": "pkg:npm/@babel/core#/googleapis/api/annotations/",
195 "expected_output": {
196 "type": "npm",
197 "namespace": "@babel",
198 "name": "core",
199 "version": null,
200 "qualifiers": null,
201 "subpath": "googleapis/api/annotations"
202 },
203 "expected_failure": false,
204 "expected_failure_reason": null
205 },
206 {
207 "description": "valid npm purl without version and with subpath, scope unencoded",
208 "test_group": "base",
209 "test_type": "parse",
210 "input": "pkg:npm/%40babel/core#/googleapis/api/annotations/",
211 "expected_output": {
212 "type": "npm",
213 "namespace": "@babel",
214 "name": "core",
215 "version": null,
216 "qualifiers": null,
217 "subpath": "googleapis/api/annotations"
218 },
219 "expected_failure": false,
220 "expected_failure_reason": null
221 },
222 {
223 "description": "valid npm purl without namespace and with subpath",
224 "test_group": "base",
225 "test_type": "roundtrip",
226 "input": "pkg:npm/[email protected]#/googleapis/api/annotations/",
227 "expected_output": "pkg:npm/[email protected]#googleapis/api/annotations",
228 "expected_failure": false,
229 "expected_failure_reason": null
230 }
231 ]
232 }