Skip to content

Commit

Permalink
Fix unit tests + remove builds and testing for node 14 & 16, adding 1…
Browse files Browse the repository at this point in the history
…8 and 20
  • Loading branch information
ddvlanck committed Feb 20, 2024
1 parent aa7ed9f commit f21274b
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 78 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ jobs:
matrix:
os: [ubuntu-latest]
node-version:
- 14.x
- 16.x
- 18.x
- 20.x
steps:
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/ci-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ jobs:
matrix:
os: [ubuntu-latest]
node-version:
- 14.x
- 16.x
- 18.x
- 20.x
steps:
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
Expand Down
6 changes: 5 additions & 1 deletion packages/oslo-converter-uml-ea/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@
"/node_modules/",
"index.js"
],
"testEnvironment": "node"
"testEnvironment": "node",
"moduleNameMapper": {
"^@oslo-core/(.*)$": "<rootDir>/../oslo-core/lib/$1",
"^@oslo-converter-uml-ea/(.*)$": "<rootDir>/lib/$1"
}
},
"scripts": {
"build": "npm run build:ts",
Expand Down
6 changes: 5 additions & 1 deletion packages/oslo-extractor-uml-ea/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@
"./lib/utils",
"./lib/types"
],
"testEnvironment": "node"
"testEnvironment": "node",
"moduleNameMapper": {
"^@oslo-core/(.*)$": "<rootDir>/../oslo-core/lib/$1",
"^@oslo-extractor-uml-ea/(.*)$": "<rootDir>/lib/$1"
}
},
"scripts": {
"build": "npm run build:ts",
Expand Down
6 changes: 5 additions & 1 deletion packages/oslo-generator-rdf-vocabulary/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@
"/node_modules/",
"index.js"
],
"testEnvironment": "node"
"testEnvironment": "node",
"moduleNameMapper": {
"^@oslo-core/(.*)$": "<rootDir>/../oslo-core/lib/$1",
"^@oslo-generator-rdf-vocabulary/(.*)$": "<rootDir>/lib/$1"
}
},
"scripts": {
"build": "npm run build:ts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
jsonldAttributeWithoutAssignedUri,
jsonldAttributeWithoutDomain,
jsonldAttributeWithParent,
jsonldAttributeWithRangeStatement,
jsonldAttributeWithRange,
jsonldClassWithoutAssignedUri,
jsonldClassWithoutDefinition,
jsonldClassWithParent,
Expand Down Expand Up @@ -138,7 +138,7 @@ describe('RdfVocabularyGenerationService', () => {
expect(quads.some((quad: RDF.Quad) =>
quad.subject.equals(df.namedNode('http://example.org/id/class/1')) &&
quad.predicate.equals(ns.vann('usageNote')) &&
quad.object.equals(df.literal('A usage note', 'en'))))
quad.object.equals(df.literal('A vocabulary usage note', 'en'))))
.toBe(true);
});

Expand Down Expand Up @@ -262,17 +262,6 @@ describe('RdfVocabularyGenerationService', () => {
expect(service.logger.error).toHaveBeenCalled();
});

it('should search in rdf:Statements for the assigned URI of a range', async () => {
store.addQuads(await parseJsonld(jsonldAttributeWithRangeStatement));
const quads = await service.createAttributeQuads(vocabularyUri);

expect(quads.some((quad: RDF.Quad) =>
quad.subject.equals(df.namedNode('http://example.org/id/property/1')) &&
quad.predicate.equals(ns.rdfs('range')) &&
quad.object.equals(df.namedNode('http://example.org/id/class/2'))))
.toBe(true);
});

it('should add a link to the parent of the attribute it that information was found', async () => {
store.addQuads(await parseJsonld(jsonldAttributeWithParent));
const quads = await service.createAttributeQuads(vocabularyUri);
Expand All @@ -286,8 +275,8 @@ describe('RdfVocabularyGenerationService', () => {

// eslint-disable-next-line max-len
it('should log an error when the definition of the attribute could not be found in the requested language', async () => {
// This 'jsonldAttributeWithRangeStatement' snippet can also be used for this test
store.addQuads(await parseJsonld(jsonldAttributeWithRangeStatement));
// This 'jsonldAttributeWithRange' snippet can also be used for this test
store.addQuads(await parseJsonld(jsonldAttributeWithRange));

jest.spyOn(service.logger, 'error');
await service.createAttributeQuads(vocabularyUri);
Expand Down
Loading

0 comments on commit f21274b

Please sign in to comment.