From 990eb8670547364018d0229ba1220c6320454e7e Mon Sep 17 00:00:00 2001 From: Rohan Mukherjee Date: Sun, 3 Oct 2021 00:03:50 +0530 Subject: [PATCH] fix: added npm test action and fixed failing tests (#14) * ci(tests): added action to run automated tests * test(tests): updated tests to succeed upon running npm t * fix(browserlists): updated browserslist packages --- .github/workflows/test.yml | 23 +++++++++++++++++++++++ package-lock.json | 21 ++++++++++----------- src/App.test.tsx | 12 +++++++++--- 3 files changed, 42 insertions(+), 14 deletions(-) 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..36f8dfa --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,23 @@ +name: Run automated tests +on: + pull_request: + branches: + - main +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + submodules: recursive + + - uses: actions/setup-node@v2 + with: + node-version: 16 + registry-url: https://registry.npmjs.org/ + + - name: npm install, test + run: | + npm install + npm test \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index af5ce04..345e42f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6521,9 +6521,13 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001208", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001208.tgz", - "integrity": "sha512-OE5UE4+nBOro8Dyvv0lfx+SRtfVIOM9uhKqFmJeUbGriqhhStgp1A0OyBpgy3OUF8AhYCT+PVwPC1gMl2ZcQMA==" + "version": "1.0.30001263", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001263.tgz", + "integrity": "sha512-doiV5dft6yzWO1WwU19kt8Qz8R0/8DgEziz6/9n2FxUasteZNwNNYSmJO3GLBH8lCVE73AB1RPDPAeYbcO5Cvw==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + } }, "node_modules/capture-exit": { "version": "2.0.0", @@ -18739,11 +18743,6 @@ "safer-buffer": "^2.0.2", "tweetnacl": "~0.14.0" }, - "bin": { - "sshpk-conv": "bin/sshpk-conv", - "sshpk-sign": "bin/sshpk-sign", - "sshpk-verify": "bin/sshpk-verify" - }, "engines": { "node": ">=0.10.0" } @@ -33053,9 +33052,9 @@ } }, "caniuse-lite": { - "version": "1.0.30001208", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001208.tgz", - "integrity": "sha512-OE5UE4+nBOro8Dyvv0lfx+SRtfVIOM9uhKqFmJeUbGriqhhStgp1A0OyBpgy3OUF8AhYCT+PVwPC1gMl2ZcQMA==" + "version": "1.0.30001263", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001263.tgz", + "integrity": "sha512-doiV5dft6yzWO1WwU19kt8Qz8R0/8DgEziz6/9n2FxUasteZNwNNYSmJO3GLBH8lCVE73AB1RPDPAeYbcO5Cvw==" }, "capture-exit": { "version": "2.0.0", diff --git a/src/App.test.tsx b/src/App.test.tsx index 2a68616..068c049 100644 --- a/src/App.test.tsx +++ b/src/App.test.tsx @@ -2,8 +2,14 @@ import React from 'react'; import { render, screen } from '@testing-library/react'; import App from './App'; -test('renders learn react link', () => { +test('contains input box for entering VNC URL', () => { render(); - const linkElement = screen.getByText(/learn react/i); - expect(linkElement).toBeInTheDocument(); + const inputElement = screen.getByPlaceholderText(/wss:\/\/your-vnc-url/i); + expect(inputElement).toBeInTheDocument(); +}); + +test('check if SSL disclaimer is present', () => { + render(); + const disclaimerElement = screen.getByText(/Since the site is loaded over HTTPS, only `wss:\/\/` URLs \(SSL encrypted websockets URLs\) are supported./i); + expect(disclaimerElement).toBeInTheDocument(); });