Skip to content

Commit

Permalink
Chore/#71 refactor tests using msw (#107)
Browse files Browse the repository at this point in the history
* test(backstage-plugin): Add msw and refactor tests

Add msw to mock backend and avoid mocking the service.
Simplify some test cases by checking for only the needed elements.
Add error handling to the data service.

Addresses #71

* test(backstage-plugin): Add data service tests

Use msw to add group data service tests and remove the ignore comment.a

Addresses #71

* test(backstage-plugin): Fix linting test files

Move test setup files out of source folder to avoid needing dependencies instead of dev dependencies
when compiling typescript.

Addresses #71

* test(backstage-plugin): Downgrade msw

Downgrade msw to be inline with backstage setup and make it work with the tsconfig.

Addresses #71

* test(backstage-plugin): Add consts for urls

Add reusable consts for testing urls to mock with msw and supply in mock config

Addresses #71

* test(backstage-plugin): Change value used in tests

So that we can check for the exact decimal used from the response.
Should help make the test a bit clearer.

Addresses #71
  • Loading branch information
kylejwatson authored Nov 20, 2023
1 parent f69ebb8 commit a5e1fb1
Show file tree
Hide file tree
Showing 8 changed files with 400 additions and 239 deletions.
13 changes: 11 additions & 2 deletions backstage-plugin/plugins/open-dora/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@
"@testing-library/user-event": "^14.0.0",
"@types/node": "*",
"cross-fetch": "^3.1.5",
"msw": "^1.0.0"
"msw": "^1.3.2",
"undici": "^5.27.2"
},
"files": [
"dist",
Expand All @@ -64,6 +65,14 @@
"lines": 100,
"statements": 100
}
}
},
"testEnvironmentOptions": {
"customExportConditions": [
""
]
},
"setupFiles": [
"../testing/jest.polyfills.js"
]
}
}
Loading

0 comments on commit a5e1fb1

Please sign in to comment.