Skip to content

Commit

Permalink
Feat/add tests (#39)
Browse files Browse the repository at this point in the history
* feat: add tests

* feat: add badges
  • Loading branch information
deepak-wednesday authored Mar 19, 2023
1 parent 08408ed commit 706c77e
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 38 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ jobs:
fi
- name: Install dependencies
run: pnpm i

- name: Commit badges
uses: EndBug/add-and-commit@v7
with:
author_name: Gitflow
author_email: git@wednesday.is
message: 'Update badges'
add: 'badges/'
push: false
# - name: Deploy
# run: pnpm deploy:dev
# env:
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,20 @@

---


<span>We’re always looking for people who value their work, so come and join us. <a href="https://www.wednesday.is/hiring"> </br> We are hiring!</a></span>

</div>

<div>
<img src='./badges/badge-statements.svg' height="20"/>
<img src='./badges/badge-branches.svg' height="20"/>
</div>
<div>
<img src='./badges/badge-lines.svg' height="20"/>
<img src='./badges/badge-functions.svg' height="20"/>
</div>

This is serverless template. This will help you get started with serverless architecture.

# Architecture
Expand Down
1 change: 1 addition & 0 deletions badges/badge-branches.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions badges/badge-functions.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions badges/badge-lines.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions badges/badge-statements.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
"-----------test-----------": "",
"test": "jest --coverage --silent --ci --runInBand --testLocationInResults --json --silent --outputFile=\"report.json\" ",
"test:local": "jest --coverage",
"test:badges": "npm run test && jest-coverage-badges --output './badges'",
"create:badges": "jest-coverage-badges --output './badges'",
"-----------build & deployment-----------": "",
"build": "sls package --stage=dev",
"deploy:dev": "sls deploy --stage=dev",
Expand Down
2 changes: 1 addition & 1 deletion report.json

Large diffs are not rendered by default.

74 changes: 37 additions & 37 deletions reports/test-report.xml
Original file line number Diff line number Diff line change
@@ -1,74 +1,74 @@
<testExecutions version="1">
<file path="services/reminders/tests/sesHelpers.test.js">
<testCase name="ses helpers test suite sendEmail tests should handle case where sending email succeeds as expected" duration="5" />
<testCase name="ses helpers test suite sendEmail tests should handle case where no parameters are not passed in" duration="1" />
<testCase name="ses helpers test suite sendEmail tests should handle case where no parameters are not passed in" duration="0" />
<testCase name="ses helpers test suite sendEmail tests should handle case where one of the parameters is not passed in" duration="0" />
<testCase name="ses helpers test suite sendEmail tests should handle case where one of the parameters is not passed in" duration="0" />
<testCase name="ses helpers test suite sendEmail tests should handle case where one of the parameters is not passed in" duration="1" />
<testCase name="ses helpers test suite sendEmail tests should handle case where finding email addresses from parameter store fails" duration="0" />
<testCase name="ses helpers test suite sendEmail tests should handle case where sending email fails as expected" duration="1" />
<testCase name="ses helpers test suite formatEmailContent tests should use the params and return formatted Body with subject and text body as expected" duration="0" />
<testCase name="ses helpers test suite sendEmail tests should handle case where sending email fails as expected" duration="2" />
<testCase name="ses helpers test suite formatEmailContent tests should use the params and return formatted Body with subject and text body as expected" duration="2" />
<testCase name="ses helpers test suite formatEmailContent tests should use the params and return formatted Body with subject and html body as expected" duration="0" />
<testCase name="ses helpers test suite formatEmailBody tests should use the params and return text body as expected" duration="0" />
<testCase name="ses helpers test suite formatEmailBody tests should use the params and return html body as expected" duration="0" />
</file>
<file path="functions/user/getUser/tests/index.test.js">
<testCase name="get todos function tests should get User properly" duration="2" />
<testCase name="get todos function tests If No User is found" duration="1" />
<testCase name="get todos function tests If get user fails" duration="1" />
<testCase name="get todos function tests should throw error if we do not get User" duration="18" />
<testCase name="get todos function tests If get user fails" duration="0" />
<testCase name="get todos function tests should throw error if we do not get User" duration="1" />
</file>
<file path="functions/user/createUser/tests/index.test.js">
<testCase name="create user function tests should create User properly" duration="2" />
<testCase name="create user function tests If create user fails" duration="1" />
<testCase name="create user function tests should throw error if User is not created properly" duration="7" />
<file path="services/notifications/tests/subscriptions.test.js">
<testCase name="SNS serice subscription for a topic tests suite subscribeToEmail method tests should return throw if no parameters are provided" duration="3" />
<testCase name="SNS serice subscription for a topic tests suite subscribeToEmail method tests should return a error message if correct params are not provided" duration="0" />
<testCase name="SNS serice subscription for a topic tests suite subscribeToEmail method tests should call the snsClient with SubscribeCommand" duration="2" />
</file>
<file path="services/parameterStore/tests/ssmHelpers.test.js">
<testCase name="ssm helpers test suite getParamsFromSSM tests should handle case where ssm params exist as expected" duration="4" />
<testCase name="ssm helpers test suite getParamsFromSSM tests should handle case where ssm params do not exist as expected" duration="1" />
<testCase name="ssm helpers test suite handleSSMResponse tests should handle case where response provided matches success scenario" duration="1" />
<testCase name="ssm helpers test suite handleSSMResponse tests should handle case where response provided matches error scenario" duration="0" />
</file>
<file path="services/notifications/tests/createSnsTopic.test.js">
<testCase name="Tests for createSnsTopic method should throw if topicName is not passed" duration="3" />
<testCase name="Tests for createSnsTopic method should call the sns client with CreateTopicCommand" duration="2" />
<testCase name="Tests for createSnsTopic method should return error accordingly" duration="1" />
</file>
<file path="functions/todo/updateTodo/tests/index.test.js">
<testCase name="update todo function tests should update Todo properly" duration="1" />
<testCase name="update todo function tests should update Todo fails" duration="0" />
<testCase name="update todo function tests should throw error if Todo is not updated properly" duration="7" />
<testCase name="update todo function tests should throw error if Todo is not updated properly" duration="2" />
</file>
<file path="functions/todo/getTodos/tests/index.test.js">
<testCase name="get todos function tests should get Todo properly" duration="2" />
<testCase name="get todos function tests should get Todo properly" duration="1" />
<testCase name="get todos function tests If Todo is empty" duration="1" />
<testCase name="get todos function tests should get Todo fails" duration="1" />
<testCase name="get todos function tests should throw error if we do not get TODO" duration="2" />
<testCase name="get todos function tests should throw error if we do not get TODO" duration="1" />
</file>
<file path="services/notifications/tests/subscriptions.test.js">
<testCase name="SNS serice subscription for a topic tests suite subscribeToEmail method tests should return throw if no parameters are provided" duration="6" />
<testCase name="SNS serice subscription for a topic tests suite subscribeToEmail method tests should return a error message if correct params are not provided" duration="1" />
<testCase name="SNS serice subscription for a topic tests suite subscribeToEmail method tests should call the snsClient with SubscribeCommand" duration="3" />
</file>
<file path="services/parameterStore/tests/ssmHelpers.test.js">
<testCase name="ssm helpers test suite getParamsFromSSM tests should handle case where ssm params exist as expected" duration="6" />
<testCase name="ssm helpers test suite getParamsFromSSM tests should handle case where ssm params do not exist as expected" duration="1" />
<testCase name="ssm helpers test suite handleSSMResponse tests should handle case where response provided matches success scenario" duration="0" />
<testCase name="ssm helpers test suite handleSSMResponse tests should handle case where response provided matches error scenario" duration="1" />
<file path="functions/todo/create/tests/index.test.js">
<testCase name="create todo function tests should create Todo properly" duration="2" />
<testCase name="create todo function tests should create Todo fails" duration="1" />
<testCase name="create todo function tests should throw error if Todo is not created properly" duration="2" />
</file>
<file path="functions/todo/removeTodo/tests/index.test.js">
<testCase name="delete todo function tests should delete Todo properly" duration="2" />
<testCase name="delete todo function tests should delete Todo properly" duration="1" />
<testCase name="delete todo function tests should delete Todo fails" duration="1" />
<testCase name="delete todo function tests should throw error if Todo is not deleted properly" duration="6" />
<testCase name="delete todo function tests should throw error if Todo is not deleted properly" duration="2" />
</file>
<file path="services/notifications/tests/createSnsTopic.test.js">
<testCase name="Tests for createSnsTopic method should throw if topicName is not passed" duration="5" />
<testCase name="Tests for createSnsTopic method should call the sns client with CreateTopicCommand" duration="3" />
<testCase name="Tests for createSnsTopic method should return error accordingly" duration="7" />
</file>
<file path="functions/todo/create/tests/index.test.js">
<testCase name="create todo function tests should create Todo properly" duration="2" />
<testCase name="create todo function tests should create Todo fails" duration="1" />
<testCase name="create todo function tests should throw error if Todo is not created properly" duration="6" />
<file path="functions/user/createUser/tests/index.test.js">
<testCase name="create user function tests should create User properly" duration="2" />
<testCase name="create user function tests If create user fails" duration="1" />
<testCase name="create user function tests should throw error if User is not created properly" duration="2" />
</file>
<file path="functions/starter-function/tests/index.test.js">
<testCase name="starter function tests should call the starter function" duration="1" />
<testCase name="starter function tests should call the starter function" duration="2" />
</file>
<file path="functions/daily-cron/tests/index.test.js">
<testCase name="starter function tests should call the starter function" duration="1" />
</file>
<file path="utils/tests/lambda-closer.test.js">
<testCase name="LambdaCloser should construct the response for 200" duration="1" />
<testCase name="LambdaCloser should construct the response for 200" duration="2" />
<testCase name="LambdaCloser should construct the response for 201" duration="0" />
<testCase name="LambdaCloser should construct a partial response for partial parameters for 200" duration="0" />
<testCase name="LambdaCloser should throw an Error if none of the required response properties provided" duration="5" />
<testCase name="LambdaCloser should throw an Error if none of the required response properties provided" duration="1" />
</file>
</testExecutions>

0 comments on commit 706c77e

Please sign in to comment.