Skip to content

[CCFPCM-395] mocks, jest config, added unit tests for entities#99

Merged
chelsea-EYDS merged 9 commits intoCHORE-exceptions-service-refactorfrom
CCFPCM-395
May 10, 2023
Merged

[CCFPCM-395] mocks, jest config, added unit tests for entities#99
chelsea-EYDS merged 9 commits intoCHORE-exceptions-service-refactorfrom
CCFPCM-395

Conversation

@chelsea-EYDS
Copy link
Contributor

@chelsea-EYDS chelsea-EYDS commented May 4, 2023

CCFPCM-0395

Objective:

  • updated jest config
  • added entity specs
  • mock data updates

@chelsea-EYDS chelsea-EYDS changed the title [CCFPCM-395] unit testing [CCFPCM-395] mocks, jest config, added unit tests for entities May 4, 2023
@chelsea-EYDS chelsea-EYDS force-pushed the CCFPCM-395 branch 2 times, most recently from 01cb8e7 to c728e68 Compare May 4, 2023 23:39
Copy link
Collaborator

@fw-noel fw-noel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Entity specs don't strike me as particularly useful, but I'd love to hear your take on their value.

}
return transactions;
}
constructor(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Constructor at the bottom?

import { Payment } from './payment_mock';
import { BaseData } from '../types/interface';
import { PaymentMock } from './payment_mock';
import { PaymentEntity } from './../../../src/transaction/entities/payment.entity';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: for consistency, we can remove ./. TBH I like it better with, but yeah

this.source_id = program;
this.location_id = location.location_id;
this.transaction_date = dateRange.to_date;
this.transaction_time = '00:00:00';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any value in randomizing / fakering this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're randomized and using faker, but have a specific set of rules in order for them to be 'reconcile-able'.

ie: if generating random cash deposits and cash transactions/payments to test (happy path) reconciliation then we need to make sure the sum of payments per fiscal_close_date === the deposit_amt_cdn for a deposit date, and also that the payment methods and locations match.

The purpose of the mocks was to avoid writing it out for each unit test, but I am 100% open to suggestions for a better approach :)

Copy link
Collaborator

@fw-noel fw-noel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Entity specs don't strike me as particularly useful, but I'd love to hear your take on their value. If it's just coverage, I'd argue for removing

@chelsea-EYDS
Copy link
Contributor Author

Entity specs don't strike me as particularly useful, but I'd love to hear your take on their value. If it's just coverage, I'd argue for removing

It's 90% for coverage, and also for examples in the codebase/regression testing. I thought it would be unlikely for these to change (and if they do change we'd need to make sure the fields used in reconciliation aren't affected or altered) but I'm sure the tests for reconciliation are enough to cover this, I'm happy to remove if you would prefer.

@chelsea-EYDS chelsea-EYDS merged commit 46c7f9b into CHORE-exceptions-service-refactor May 10, 2023
@chelsea-EYDS chelsea-EYDS deleted the CCFPCM-395 branch May 10, 2023 03:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants