Skip to content

Commit

Permalink
fix: add unit test for insertTagIntoTransactionTagsString
Browse files Browse the repository at this point in the history
  • Loading branch information
daledah committed Aug 22, 2024
1 parent 086de7d commit 5f7cb17
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/unit/IOUUtilsTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,24 @@ describe('IOUUtils', () => {
expect(IOUUtils.calculateAmount(participantsAccountIDs.length, 100, 'BHD')).toBe(33);
});
});

describe('insertTagIntoTransactionTagsString', () => {
test('Inserting a tag into tag string should update the tag', () => {
expect(IOUUtils.insertTagIntoTransactionTagsString(':NY:Texas', 'California', 2)).toBe(':NY:California');
});

test('Inserting a tag into an index with no tags should update the tag', () => {
expect(IOUUtils.insertTagIntoTransactionTagsString('::California', 'NY', 1)).toBe(':NY:California');
});

test('Inserting a tag with colon in name into tag string should keep the colon in tag', () => {
expect(IOUUtils.insertTagIntoTransactionTagsString('East:NY:California', 'City \\: \\:', 1)).toBe('East:City \\: \\::California');
});

test('Remove a tag from tagString', () => {
expect(IOUUtils.insertTagIntoTransactionTagsString('East:City \\: \\::California', '', 1)).toBe('East::California');
});
});
});

describe('isValidMoneyRequestType', () => {
Expand Down

0 comments on commit 5f7cb17

Please sign in to comment.