Skip to content

Commit

Permalink
fix: update mocha tests
Browse files Browse the repository at this point in the history
feat: update github actions to node 20
  • Loading branch information
Raphael Stärk committed Apr 9, 2024
1 parent cac8468 commit 87a62ec
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 28 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
node: ['18']
node: [20.x]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}

Expand All @@ -29,7 +29,7 @@ jobs:
npm run docs
- name: Publish
uses: peaceiris/actions-gh-pages@v3
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ jobs:
timeout-minutes: 10
strategy:
matrix:
node-version: [18.x]
node-version: [20.x]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm install
Expand All @@ -33,11 +33,11 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
node-version: [20.x]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm install
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ jobs:
name: Release / Node ${{ matrix.node }}
strategy:
matrix:
node: ['18']
node: [20.x]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}

Expand All @@ -26,7 +26,7 @@ jobs:
npm run build
- name: Create a release
run: npx semantic-release@^18.0.0
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"@typescript-eslint/parser": "^5.0.0",
"bundle-declarations-webpack-plugin": "^5.1.1",
"chai": "^4.3.7",
"chai-uuid": "^1.0.6",
"dotenv": "^16.3.1",
"eslint": "^8.54.0",
"eslint-config-prettier": "^9.0.0",
Expand Down
14 changes: 7 additions & 7 deletions test/FormController.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,28 @@ describe('FormController', () => {
it('.getForm()', async () => {
const form = await hybridforms.forms.getForm(
'3ee88190-749a-4c65-8437-e392f6eabf71',
'868aa759-8c9b-de3c-a3d9-1c29932b4e05'
'3bd1644a-e841-4e17-84f2-8bf2b28b04f1'
);
expect(form).to.not.equal(null);
expect(form?.response?.version).to.equal(16);
expect(form?.response?.files?.length).to.equal(4);
expect(form?.response?.version).to.equal(11);
expect(form?.response?.files?.length).to.equal(6);
});

it('.listFormFiles()', async () => {
const files = await hybridforms.forms.listFormFiles(
'3ee88190-749a-4c65-8437-e392f6eabf71',
'868aa759-8c9b-de3c-a3d9-1c29932b4e05'
'3bd1644a-e841-4e17-84f2-8bf2b28b04f1'
);
expect(files).to.not.equal(null);
expect(files?.response).to.be.an('array');
expect(files?.response?.length).to.equal(4);
expect(files?.response?.length).to.equal(6);
});

it('.getFormFile()', async () => {
const file = await hybridforms.forms.getFormFile(
'3ee88190-749a-4c65-8437-e392f6eabf71',
'868aa759-8c9b-de3c-a3d9-1c29932b4e05',
'Basistest-Controls.pdf'
'3bd1644a-e841-4e17-84f2-8bf2b28b04f1',
'Basistest-Controls_.pdf'
);
expect(file).to.not.equal(null);
expect(file?.response?.type).to.equal('application/pdf');
Expand Down
11 changes: 5 additions & 6 deletions test/HybridFormsClient.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { expect, use } from 'chai';
import chaiUuid from 'chai-uuid';
import { expect } from 'chai';
import { createClient } from '../src';
import HybridFormsClient from '../src/HybridFormsClient';

use(chaiUuid);

const hybridforms: HybridFormsClient = createClient({
baseUrl: process.env.HF_BASE_URL ?? '',
clientId: '1',
Expand All @@ -14,12 +11,14 @@ const hybridforms: HybridFormsClient = createClient({

describe('HybridFormsClient', () => {
it('.request()', async () => {
const url =
(process.env.HF_BASE_URL as string) + '/api/app/gatewaydata';
const resp = await hybridforms.request({
url: 'https://httpbin.org/uuid',
url,
type: 'GET',
responseType: 'json'
});
expect(resp?.response).to.not.equal(null);
expect(resp?.response?.uuid).to.be.a.uuid('v4');
expect(resp?.response?.product).to.equal('HybridForms Server');
});
});

0 comments on commit 87a62ec

Please sign in to comment.