forked from skohub-io/skohub-reconcile-publish
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'skohub-io:main' into feature-webhook
- Loading branch information
Showing
5 changed files
with
54 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Build | ||
|
||
on: push | ||
|
||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [18.x] | ||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- run: echo Using node version $(node --version) | ||
- run: echo Using npm version $(npm --version) | ||
- run: cp .env.sample .env | ||
|
||
- name: Cache node modules | ||
id: cache-npm | ||
uses: actions/cache@v3 | ||
env: | ||
cache-name: cache-node-modules | ||
with: | ||
# npm cache files are stored in `~/.npm` on Linux/macOS | ||
path: ~/.npm | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-build-${{ env.cache-name }}- | ||
${{ runner.os }}-build- | ||
${{ runner.os }}- | ||
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} | ||
name: List the state of node modules | ||
continue-on-error: true | ||
run: npm list | ||
|
||
- run: npm install | ||
- run: npm run test | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
import {describe, expect, it, vi} from "vitest"; | ||
import {buildJSON} from "./buildJSON.js"; | ||
import { describe, expect, it, vi } from "vitest"; | ||
import { buildJSON } from "./buildJSON.js"; | ||
import { hcrt_jsonld } from "./__mocks__/valid/hcrt_jsonld.js"; | ||
import fs from "fs"; | ||
|
||
describe("buildJSON", () => { | ||
it("throws error if no preferredNamespaceUri is provided", async () => { | ||
const filePath = "./src/publishToReconciliation/__mocks__/no_prefNamespace_hcrt.ttl" | ||
const ttlString = await fs.readFileSync(filePath).toString(); | ||
const ttlString = await fs.readFileSync(filePath).toString(); | ||
await expect(() => buildJSON(ttlString.toString(), "test")).rejects.toThrowError(/preferredNamespaceUri/i); | ||
}) | ||
|
||
it("throws no error if no preferredNamespaceUri is provided", async () => { | ||
it.skip("throws no error if no preferredNamespaceUri is provided", async () => { | ||
const filePath = "./src/publishToReconciliation/__mocks__/hcrt.ttl" | ||
const ttlString = await fs.readFileSync(filePath).toString(); | ||
const ttlString = await fs.readFileSync(filePath).toString(); | ||
const j = await buildJSON(ttlString.toString(), "test") | ||
expect(j).toEqual(hcrt_jsonld) | ||
}) | ||
}); | ||
}); |