use of org.eclipse.dash.licenses.cli.PackageLockFileReader in project dash-licenses by eclipse.
the class PackageLockFileReaderTests method testV2Format.
@Test
void testV2Format() throws IOException {
try (InputStream input = this.getClass().getResourceAsStream(PACKAGE_LOCK_V2_JSON)) {
PackageLockFileReader reader = new PackageLockFileReader(input);
// This "test" is a little... abridged. At least this test proves
// that we're getting something in the right format from the reader
// without having to enumerate all 574 (I think) records).
String[] expected = { "npm/npmjs/@babel/code-frame/7.12.13", "npm/npmjs/@babel/compat-data/7.13.15", "npm/npmjs/@babel/core/7.13.15" };
String[] found = reader.getContentIds().stream().limit(3).map(IContentId::toString).sorted().toArray(String[]::new);
assertArrayEquals(expected, found);
}
}
use of org.eclipse.dash.licenses.cli.PackageLockFileReader in project dash-licenses by eclipse.
the class PackageLockFileReaderTests method testV1Format.
@Test
void testV1Format() throws IOException {
try (InputStream input = this.getClass().getResourceAsStream(PACKAGE_LOCK_JSON)) {
PackageLockFileReader reader = new PackageLockFileReader(input);
String[] expected = { "npm/npmjs/-/loglevel/1.6.1", "npm/npmjs/-/sax/1.2.4", "npm/npmjs/-/saxes/3.1.9", "npm/npmjs/-/slimdom-sax-parser/1.1.3", "npm/npmjs/-/slimdom/2.2.1", "npm/npmjs/-/xml-js/1.6.11", "npm/npmjs/-/xmlchars/1.3.1", "npm/npmjs/@namespace/fontoxpath/3.3.0" };
String[] found = reader.getContentIds().stream().map(IContentId::toString).sorted().toArray(String[]::new);
assertArrayEquals(expected, found);
}
}
Aggregations