Changeset View
Changeset View
Standalone View
Standalone View
swh/indexer/tests/metadata_dictionary/test_npm.py
Show First 20 Lines • Show All 372 Lines • ▼ Show 20 Lines | "bugs": { | ||||
result = MAPPINGS["NpmMapping"]().translate(package_json) | result = MAPPINGS["NpmMapping"]().translate(package_json) | ||||
assert result == { | assert result == { | ||||
"@context": "https://doi.org/10.5063/schema/codemeta-2.0", | "@context": "https://doi.org/10.5063/schema/codemeta-2.0", | ||||
"type": "SoftwareSourceCode", | "type": "SoftwareSourceCode", | ||||
"author": [{"name": "foo", "type": "Person"}], | "author": [{"name": "foo", "type": "Person"}], | ||||
"version": "1.0.0", | "version": "1.0.0", | ||||
} | } | ||||
package_json = rb"""{ | |||||
"version": "1.0.0", | |||||
"repository": "git+https://g ithub.com/foo/bar.git" | |||||
}""" | |||||
result = MAPPINGS["NpmMapping"]().translate(package_json) | |||||
assert result == { | |||||
"@context": "https://doi.org/10.5063/schema/codemeta-2.0", | |||||
"type": "SoftwareSourceCode", | |||||
"version": "1.0.0", | |||||
} | |||||
def test_npm_invalid_licenses(): | def test_npm_invalid_licenses(): | ||||
package_json = rb"""{ | package_json = rb"""{ | ||||
"version": "1.0.0", | "version": "1.0.0", | ||||
"license": "SEE LICENSE IN LICENSE.md", | "license": "SEE LICENSE IN LICENSE.md", | ||||
"author": { | "author": { | ||||
"name": "foo", | "name": "foo", | ||||
"url": "http://example.org" | "url": "http://example.org" | ||||
▲ Show 20 Lines • Show All 50 Lines • Show Last 20 Lines |