Skip to content
This repository has been archived by the owner on Oct 7, 2022. It is now read-only.

Adding unit tests for functions #260

Merged
merged 2 commits into from
Mar 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,15 @@ jobs:
name: Download and install official Google Chrome package
command: wget 'https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb' && sudo dpkg -i google-chrome-stable_current_amd64.deb
- run:
name: Run tests
name: Run integration tests
command: npm run test:integration
- run:
name: Run cloud function tests
command: npm run test:functions
- store_artifacts:
path: ./screenshots
- store_artifacts:
path: ./functions/coverage
# This pushes our deployable assets to a branch, for SRE to use in deploying to stage and prod.
deploy-branch-update:
docker:
Expand Down
2 changes: 2 additions & 0 deletions functions/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ module.exports = {
},
ignorePatterns: [
"/lib/**/*", // Ignore built files.
"coverage/**/*", // Ignore coverage files.
"jest.config.js", // Ignore jest config.
],
plugins: ["@typescript-eslint", "import"],
rules: {
Expand Down
2 changes: 2 additions & 0 deletions functions/.testenv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
GCLOUD_PROJECT="demo-rally"
FIRESTORE_EMULATOR_HOST="localhost:8080"
7 changes: 7 additions & 0 deletions functions/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
preset: "ts-jest",
testRegex: "src(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
testPathIgnorePatterns: ["lib/", "node_modules/", "setupTests.js"],
moduleFileExtensions: ["js", "ts", "tsx", "jsx", "json", "node"],
testEnvironment: "node",
};
Loading