From bd212d35becfc625341faa46ea7d059155d05ad5 Mon Sep 17 00:00:00 2001 From: Chris Wood Date: Mon, 23 May 2022 19:41:24 +0100 Subject: [PATCH 1/4] GitHub action --- .github/workflows/test.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..8498644 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,11 @@ +name: CI +on: push +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install modules + run: npm install + - name: Run tests + run: npm test \ No newline at end of file From ce5603d35ddb081cdc3526d4c41f5f38280df8d4 Mon Sep 17 00:00:00 2001 From: Chris Wood Date: Mon, 23 May 2022 19:54:00 +0100 Subject: [PATCH 2/4] Action tweaks --- .github/workflows/test.yml | 9 ++++++--- connectors/prism3.js | 2 +- package.json | 1 + tests/index.js | 4 ++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8498644..a903ea1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,11 +1,14 @@ name: CI -on: push +on: + push + #schedule: + # - cron: "0 13 * * 1" # Every Monday at 13:00 jobs: - build: + test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Install modules run: npm install - name: Run tests - run: npm test \ No newline at end of file + run: npm test-ci \ No newline at end of file diff --git a/connectors/prism3.js b/connectors/prism3.js index 0d5cf76..3ab458b 100644 --- a/connectors/prism3.js +++ b/connectors/prism3.js @@ -28,7 +28,7 @@ exports.getLibraries = async function (service) { const $ = cheerio.load(advancedSearchPageRequest.text) $('#locdd option').each((idx, option) => { - if (common.isLibrary($(option).text())) responseLibraries.libraries.push($(option).text().trim()) + if (common.isLibrary($(option).text().trim())) responseLibraries.libraries.push($(option).text().trim()) }) } catch(e) { diff --git a/package.json b/package.json index 08637b2..52540e0 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "dev": "webpack-dev-server --open --mode development", "build": "webpack --mode production", "test": "jest --runInBand", + "test-ci": "jest --silent", "test-file": "jest --no-color 2>output.txt" }, "repository": { diff --git a/tests/index.js b/tests/index.js index dae8285..f33d583 100644 --- a/tests/index.js +++ b/tests/index.js @@ -15,7 +15,7 @@ exports.runTest = async (isbn, service) => { // Libraries results = await index.libraries(service); - console.log(results); + //console.log(results); expect(results).not.toHaveLength(0); if (!librariesIgnoreList.includes(service)) @@ -23,7 +23,7 @@ exports.runTest = async (isbn, service) => { // Availability results = await index.availability(isbn, service); - console.log(results); + //console.log(results); expect(results).not.toHaveLength(0); if (!availabilityIgnoreList.includes(service)) { From c17bfa73518ec05993d87504d8962346e64bb08c Mon Sep 17 00:00:00 2001 From: Chris Wood Date: Mon, 23 May 2022 19:54:54 +0100 Subject: [PATCH 3/4] Fix action --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a903ea1..f50173b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,4 +11,4 @@ jobs: - name: Install modules run: npm install - name: Run tests - run: npm test-ci \ No newline at end of file + run: npm run test-ci \ No newline at end of file From cf4e200b1b67c89fad457523bde9c01d51d5600d Mon Sep 17 00:00:00 2001 From: Chris Wood Date: Mon, 23 May 2022 20:15:34 +0100 Subject: [PATCH 4/4] Make tests run on a schedule --- .github/workflows/test.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f50173b..360318d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,8 +1,7 @@ name: CI on: - push - #schedule: - # - cron: "0 13 * * 1" # Every Monday at 13:00 + schedule: + - cron: "0 13 * * 5" # Every Friday at 13:00 UTC jobs: test: runs-on: ubuntu-latest