Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pisp-demo-server] Firebase Unit Tests #1689

Closed
8 tasks
akapur99 opened this issue Sep 9, 2020 · 7 comments
Closed
8 tasks

[pisp-demo-server] Firebase Unit Tests #1689

akapur99 opened this issue Sep 9, 2020 · 7 comments
Labels

Comments

@akapur99
Copy link

akapur99 commented Sep 9, 2020

Goal:

As a PISP Server

I want to write unit tests for firebase methods (mocked)

so that I can ensure current and future firebase methods work correctly

Complexity: Low
Uncertainty: Low


Tasks:

  • Add Necessary Mocks
  • Write unit tests for firebase methods

Done

  • Acceptance Criteria pass
  • Designs are up-to date
  • Unit Tests pass
  • Integration Tests pass
  • Code Style & Coverage meets standards

Pull Requests:

  • TBD

Follow-up:

  • N/A

Dependencies:

  • N/A

Accountability:

  • Owner: TBC
  • QA/Review: TBC
@akapur99 akapur99 added oss-pisp OSS PISP team's items - stories, bugs, epics story labels Sep 9, 2020
@akapur99 akapur99 self-assigned this Sep 9, 2020
@lewisdaly
Copy link
Contributor

My $0.02 - we should start with solid unit tests on the business domain, and not go into all of the fuss of trying to find the right libraries to do the right things for us, that may not even end up testing 100% of what we want.

For testing our model serialization and deserialization, firebase triggers etc. we can then look at proper integration tests with a locally running firebase emulator or something.

@akapur99
Copy link
Author

I think you're absolutely right - spent a bunch of time yesterday and today exploring third party mocking libraries + firebase emulator/test solutions and they add unnecessary complexity or added refactoring. Had a discussion with @eoln about this earlier today, and we decided to stick to a barebones jest mocking and just slightly expanding the mocking we already have in place thanks to steven. As you mentioned our focus for unit testing is just to make sure that that we're calling the correct firebase methods with the right parameters, the actual test of functionality should be done through integration testing.

@eoln
Copy link

eoln commented Sep 15, 2020

@lewisdaly we have had a chat with @akapur99 today. I suggested it's not worth to use this simulator because we will have to implement integration tests later so it will be double work. Also using ts-mock-firebase module isn't the option because we both can't install it properly and this project looks parked because of lack of resources. With @akapur99 we agreed that the best option is to extend a little existing mocking https://github.com/mojaloop/pisp-demo-server/blob/master/src/lib/firebase/__mocks__/index.ts and identify patterns in code which wich need testing. Implement one test for each of them, grab experience, make a retro and then discuss together where to go next.

@THEADEV THEADEV added this to the PISP 11.4 milestone Sep 15, 2020
@lewisdaly
Copy link
Contributor

Cool. Thanks for the updates.

@akapur99
Copy link
Author

akapur99 commented Sep 16, 2020

Currently attempting this via https://github.com/dmurvihill/firebase-mock
Local in-memory firebase unit testing

@THEADEV THEADEV modified the milestones: PISP 11.4, PISP 11.5 Sep 21, 2020
@akapur99 akapur99 changed the title [pisp-demo-server] Firebase Emulation and Unit Tests [pisp-demo-server] Firebase Unit Tests Sep 22, 2020
@akapur99
Copy link
Author

Moving to doing 'bare-minimum' testing using basic jest mocking
Created an issue for better unit tests in the repo
mojaloop/contrib-pisp-demo-svc#35

@lewisdaly
Copy link
Contributor

@kkzeng please close after confirming that it's only the repository level code left.

@elnyry-sam-k elnyry-sam-k modified the milestones: PISP 11.5, PISP 11.6 Oct 27, 2020
@elnyry-sam-k elnyry-sam-k modified the milestones: PISP 11.6, Sprint 12.1 Nov 2, 2020
@lewisdaly lewisdaly removed the oss-pisp OSS PISP team's items - stories, bugs, epics label Nov 3, 2020
@elnyry-sam-k elnyry-sam-k modified the milestones: Sprint 12.1, Sprint 12.3 Nov 27, 2020
@elnyry-sam-k elnyry-sam-k removed this from the Sprint 12.3 milestone Jan 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants