Skip to content

Instantly share code, notes, and snippets.

@goldbergyoni
Created April 18, 2021 06:49
Show Gist options
  • Select an option

  • Save goldbergyoni/28ea44bf669e50bd8c32d82aa1375d1d to your computer and use it in GitHub Desktop.

Select an option

Save goldbergyoni/28ea44bf669e50bd8c32d82aa1375d1d to your computer and use it in GitHub Desktop.
Clean tests - Better test
test("When no credit, the declined transfer does not appear in sender history", () => {
// Arrange
const transferRequest = testHelpers.factorMoneyTransfer({
sender: { credit: 50 },
transferAmount: 100,
});
const transferServiceUnderTest = new TransferService({ creditPolicy: "NoCredit" });
// Act
transferServiceUnderTest.transfer(transferRequest);
// Assert
const senderTransfersHistory = transferServiceUnderTest.getTransfers(transferRequest.sender.name);
expect(senderTransfersHistory).not.toContain(transferRequest);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment