Skip to content
This repository has been archived by the owner on Nov 8, 2018. It is now read-only.

Using Mocks for Unit Tests with external Dependencies #107

Open
3 tasks
paavininanda opened this issue Mar 17, 2018 · 4 comments
Open
3 tasks

Using Mocks for Unit Tests with external Dependencies #107

paavininanda opened this issue Mar 17, 2018 · 4 comments

Comments

@paavininanda
Copy link
Member

Description

As a programmer,
I need the unit tests to work properly,
so that I can have the app function without any glitches.
Currently one of the test related to authentication is failing -

Executing (default): SELECT id, fname, lname, email, password, verificationStatus, resetPasswordToken, resetPasswordExpires, provider, google_id, google_token FROM user_accounts AS user_account WHERE user_account.email = '[email protected]' LIMIT 1;
POST /auth/login 200 6.072 ms - 61
1) "before all" hook: Login
Executing (default): DELETE FROM user_accounts WHERE email = '[email protected]'
3 passing (275ms)
1 failing

  1. Testing APIs Creating User Authentication "before all" hook: Login:
    Uncaught TypeError: Cannot read property 'email' of undefined
    at Test. (test/test.js:94:34)
    at Test.assert (node_modules/supertest/lib/test.js:179:6)
    at assert (node_modules/supertest/lib/test.js:131:12)
    at node_modules/supertest/lib/test.js:128:5
    at Test.Request.callback (node_modules/superagent/lib/node/index.js:706:12)
    at parser (node_modules/superagent/lib/node/index.js:906:18)
    at IncomingMessage.res.on.e (node_modules/superagent/lib/node/parsers/json.js:19:7)
    at endReadableNT (_stream_readable.js:974:12)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickCallback (internal/process/next_tick.js:104:9)

It is happening because we are calling a email API in the unit tests. We need to find another way to test this.

Acceptance Criteria

Update [Required]

  • Correct the unit test

Definition of Done

  • All of the required items are completed.
  • Approval by 1 mentor.

Estimation

1-2 hours

@paavininanda paavininanda mentioned this issue Mar 17, 2018
3 tasks
@paavininanda paavininanda changed the title Avoiding the use of dummy email in the unit tests Avoiding the use of temporary email in the unit tests Mar 17, 2018
@Buddhiprabha
Copy link
Member

@paavininanda are you working on this?

@shreyans29
Copy link

@paavininanda I would suggest renaming it to "Using Mocks for Unit Tests with external Dependencies". It would be more generalized and will be true for every other sevice.

@Buddhiprabha
Copy link
Member

Is anyone working on this? If not @lunayach can look at this. Please confirm @paavininanda @shreyans29

@paavininanda paavininanda changed the title Avoiding the use of temporary email in the unit tests Using Mocks for Unit Tests with external Dependencies May 5, 2018
@paavininanda
Copy link
Member Author

No I am not working on this. @lunayach you can go ahead :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

3 participants