Skip to content

Commit

Permalink
Update getSelectedFeed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
VickyStash committed Nov 14, 2024
1 parent 4aa6297 commit 07cb200
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions tests/unit/CardUtilsTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,18 +161,30 @@ describe('CardUtils', () => {
});

describe('getSelectedFeed', () => {
it('Should return last selected feed', () => {
const lastSelectedFeed = CONST.COMPANY_CARD.FEED_BANK_NAME.VISA;
const selectedFeed = CardUtils.getSelectedFeed(lastSelectedFeed, cardFeedsCollection.FAKE_ID_1);
expect(selectedFeed).toBe(lastSelectedFeed);
it('Should return last selected custom feed', () => {
const lastSelectedCustomFeed = CONST.COMPANY_CARD.FEED_BANK_NAME.VISA;
const selectedFeed = CardUtils.getSelectedFeed(lastSelectedCustomFeed, cardFeedsCollection.FAKE_ID_1);
expect(selectedFeed).toBe(lastSelectedCustomFeed);
});

it('Should return the first available feed if lastSelectedFeed is undefined', () => {
it('Should return last selected direct feed', () => {
const lastSelectedDirectFeed = CONST.COMPANY_CARD.FEED_BANK_NAME.CHASE;
const selectedFeed = CardUtils.getSelectedFeed(lastSelectedDirectFeed, cardFeedsCollection.FAKE_ID_1);
expect(selectedFeed).toBe(lastSelectedDirectFeed);
});

it('Should return the first available custom feed if lastSelectedFeed is undefined', () => {
const lastSelectedFeed = undefined;
const selectedFeed = CardUtils.getSelectedFeed(lastSelectedFeed, cardFeedsCollection.FAKE_ID_1);
const selectedFeed = CardUtils.getSelectedFeed(lastSelectedFeed, cardFeedsCollection.FAKE_ID_3);
expect(selectedFeed).toBe(CONST.COMPANY_CARD.FEED_BANK_NAME.MASTER_CARD);
});

it('Should return the first available direct feed if lastSelectedFeed is undefined', () => {
const lastSelectedFeed = undefined;
const selectedFeed = CardUtils.getSelectedFeed(lastSelectedFeed, cardFeedsCollection.FAKE_ID_2);
expect(selectedFeed).toBe(CONST.COMPANY_CARD.FEED_BANK_NAME.CHASE);
});

it('Should return undefined if lastSelectedFeed is undefined and there is no card feeds', () => {
const lastSelectedFeed = undefined;
const cardFeeds = undefined;
Expand Down

0 comments on commit 07cb200

Please sign in to comment.