|
1 |
| -import {expect, test} from '@jest/globals' |
| 1 | +import {expect, test, describe} from '@jest/globals' |
2 | 2 | import * as spdx from '../src/spdx'
|
3 | 3 |
|
4 |
| -test('satisfiesAny', () => { |
| 4 | +describe('satisfiesAny', () => { |
5 | 5 | const units = [
|
6 | 6 | {
|
7 | 7 | candidate: 'MIT',
|
@@ -59,17 +59,14 @@ test('satisfiesAny', () => {
|
59 | 59 | ]
|
60 | 60 |
|
61 | 61 | for (const unit of units) {
|
62 |
| - let got: boolean = spdx.satisfiesAny(unit.candidate, unit.licenses) |
63 |
| - if (got != unit.expected) { |
64 |
| - console.log( |
65 |
| - `failing unit test inputs: candidate(${unit.candidate}) licenses(${unit.licenses})` |
66 |
| - ) |
67 |
| - } |
68 |
| - expect(got).toBe(unit.expected) |
| 62 | + const got: boolean = spdx.satisfiesAny(unit.candidate, unit.licenses) |
| 63 | + test(`should return ${unit.expected} for ("${unit.candidate}", "${unit.licenses}")`, () => { |
| 64 | + expect(got).toBe(unit.expected) |
| 65 | + }) |
69 | 66 | }
|
70 | 67 | })
|
71 | 68 |
|
72 |
| -test('satisfiesAll', () => { |
| 69 | +describe('satisfiesAll', () => { |
73 | 70 | const units = [
|
74 | 71 | {
|
75 | 72 | candidate: 'MIT',
|
@@ -137,17 +134,14 @@ test('satisfiesAll', () => {
|
137 | 134 | ]
|
138 | 135 |
|
139 | 136 | for (const unit of units) {
|
140 |
| - let got: boolean = spdx.satisfiesAll(unit.candidate, unit.licenses) |
141 |
| - if (got != unit.expected) { |
142 |
| - console.log( |
143 |
| - `failing unit test inputs: candidate(${unit.candidate}) licenses(${unit.licenses})` |
144 |
| - ) |
145 |
| - } |
146 |
| - expect(got).toBe(unit.expected) |
| 137 | + const got: boolean = spdx.satisfiesAll(unit.candidate, unit.licenses) |
| 138 | + test(`should return ${unit.expected} for ("${unit.candidate}", "${unit.licenses}")`, () => { |
| 139 | + expect(got).toBe(unit.expected) |
| 140 | + }) |
147 | 141 | }
|
148 | 142 | })
|
149 | 143 |
|
150 |
| -test('satisfies', () => { |
| 144 | +describe('satisfies', () => { |
151 | 145 | const units = [
|
152 | 146 | {
|
153 | 147 | candidate: 'MIT',
|
@@ -220,17 +214,14 @@ test('satisfies', () => {
|
220 | 214 | ]
|
221 | 215 |
|
222 | 216 | for (const unit of units) {
|
223 |
| - let got: boolean = spdx.satisfies(unit.candidate, unit.constraint) |
224 |
| - if (got != unit.expected) { |
225 |
| - console.log( |
226 |
| - `failing unit test inputs: candidateExpr(${unit.candidate}) constraintExpr(${unit.constraint})` |
227 |
| - ) |
228 |
| - } |
229 |
| - expect(got).toBe(unit.expected) |
| 217 | + const got: boolean = spdx.satisfies(unit.candidate, unit.constraint) |
| 218 | + test(`should return ${unit.expected} for ("${unit.candidate}", "${unit.constraint}")`, () => { |
| 219 | + expect(got).toBe(unit.expected) |
| 220 | + }) |
230 | 221 | }
|
231 | 222 | })
|
232 | 223 |
|
233 |
| -test('isValid', () => { |
| 224 | +describe('isValid', () => { |
234 | 225 | const units = [
|
235 | 226 | {
|
236 | 227 | candidate: 'MIT',
|
@@ -258,10 +249,9 @@ test('isValid', () => {
|
258 | 249 | }
|
259 | 250 | ]
|
260 | 251 | for (const unit of units) {
|
261 |
| - let got: boolean = spdx.isValid(unit.candidate) |
262 |
| - if (got != unit.expected) { |
263 |
| - console.log(`failing unit test inputs: candidateExpr(${unit.candidate})`) |
264 |
| - } |
265 |
| - expect(got).toBe(unit.expected) |
| 252 | + const got: boolean = spdx.isValid(unit.candidate) |
| 253 | + test(`should return ${unit.expected} for ("${unit.candidate}")`, () => { |
| 254 | + expect(got).toBe(unit.expected) |
| 255 | + }) |
266 | 256 | }
|
267 | 257 | })
|
0 commit comments