Skip to content

Commit

Permalink
fix: added npm test action and fixed failing tests (roerohan#14)
Browse files Browse the repository at this point in the history
* ci(tests): added action to run automated tests

* test(tests): updated tests to succeed upon running npm t

* fix(browserlists): updated browserslist packages
  • Loading branch information
roerohan authored Oct 2, 2021
1 parent ee59941 commit 990eb86
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 14 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -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
21 changes: 10 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 9 additions & 3 deletions src/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(<App />);
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(<App />);
const disclaimerElement = screen.getByText(/Since the site is loaded over HTTPS, only `wss:\/\/` URLs \(SSL encrypted websockets URLs\) are supported./i);
expect(disclaimerElement).toBeInTheDocument();
});

0 comments on commit 990eb86

Please sign in to comment.