Skip to content

Commit 626fdb1

Browse files
committed
feat: license file gathering
Signed-off-by: Jan Kowalleck <[email protected]>
1 parent b8d2fd0 commit 626fdb1

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

tests/unit/_helpers.mime.spec.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*!
2+
This file is part of CycloneDX JavaScript Library.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
16+
SPDX-License-Identifier: Apache-2.0
17+
Copyright (c) OWASP Foundation. All Rights Reserved.
18+
*/
19+
20+
const assert = require('node:assert')
21+
22+
const { suite, test } = require('mocha')
23+
24+
25+
const {
26+
getMimeForLicenseFile
27+
} = require('../../dist.node/_helpers/mime.js')
28+
29+
suite('_helpers.mime.getMimeForLicenseFile', () => {
30+
for (const {fileName, expected} of [
31+
['LICENCE', 'text/plain'],
32+
['site.html', 'text/html'],
33+
['license.md', 'text/markdown'],
34+
['info.xml', 'text/xml'],
35+
['UNKNOWN', 'text/plain'],
36+
['LICENCE.MIT', 'text/plain']
37+
]) {
38+
test(`check fileName`, () => {
39+
const value = getMimeForLicenseFile(fileName)
40+
expect(value).toBe(expected)
41+
})
42+
}
43+
})

0 commit comments

Comments
 (0)