Skip to content

Commit

Permalink
Merge pull request #103 from YotaYota/test.react-testing-library
Browse files Browse the repository at this point in the history
Test.react testing library
  • Loading branch information
indy-independence committed Apr 26, 2024
2 parents da6a484 + b6e5b7d commit 04be3f8
Show file tree
Hide file tree
Showing 13 changed files with 1,161 additions and 12 deletions.
8 changes: 7 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
{
"presets": ["@babel/preset-env", "@babel/preset-react"],
"presets": [
[
"@babel/preset-env",
{ "targets": { "node": "current" }, "shippedProposals": true }
],
["@babel/preset-react", { "runtime": "automatic" }]
],
"plugins": [
[
"prismjs",
Expand Down
9 changes: 9 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
API_URL=https://localhost
FIRMWARE_URL=https://localhost/firmware/
FIRMWARE_REPO_URL=https://repo/firmware/
FIRMWARE_REPO_METADATA_URL=https://repo/firmware.json
TEMPLATES_WEB_URL=https://localhost
SETTINGS_WEB_URL=https://localhost
MONITORING_WEB_URL=https://localhost
OIDC_ENABLED=true
PERMISSIONS_DISABLED=true
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"plugin:prettier/recommended" // needs to be last
],
"env": {
"browser": true
"browser": true,
"jest": true
},
"rules": {
"camelcase": "warn",
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: CI

on:
pull_request:
branches:
- develop
push:
branches:
- develop

jobs:
test:
name: Test

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18.x'
- run: npm ci
- run: npm run build
- run: npm test
1 change: 1 addition & 0 deletions __mocks__/fileMock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = "test-file-stub";
1 change: 1 addition & 0 deletions __mocks__/styleMock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {};
11 changes: 11 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const config = {
testEnvironment: "jsdom",
moduleNameMapper: {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$":
"<rootDir>/__mocks__/fileMock.js",
"\\.(css|less|sass|scss)$": "<rootDir>/__mocks__/styleMock.js",
},
setupFilesAfterEnv: ["<rootDir>/public/setupTests.js"],
};

module.exports = config;
Loading

0 comments on commit 04be3f8

Please sign in to comment.