svb-hikip / hikipfe-react-public

4 stars 20 forks source link

Task 11 - Make unit tests using jest #37 #70

Open anthonym995 opened 2 months ago

anthonym995 commented 2 months ago

Description

Unit test wirtten for the following dashboard components and fixed some minor bugs

The following dev dependencies added

"devDependencies": {
    "@babel/preset-env": "^7.24.7",
    "@babel/preset-react": "^7.24.7",
    "@testing-library/jest-dom": "^6.4.6",
    "@testing-library/react": "^16.0.0",
    "babel-jest": "^29.7.0",
    "jest": "^29.7.0",
    "jest-environment-jsdom": "^29.7.0",
    "react-test-renderer": "^18.3.1"
  }

.babelrc added

{
  "presets": [
    ["@babel/preset-env", { "targets": { "node": "current" } }],
    ["@babel/preset-react", { "runtime": "automatic" }]
  ]
}

jest.config.mjs added


/** @type {import('jest').Config} */

const config = {
  clearMocks: true,
  testEnvironment: "jsdom",
  setupFilesAfterEnv: ["<rootDir>/jest.setup.js"],
}

jest.setup.js file added

will update remaining component as soon as possible, please comment if any issue.