Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nedsalk committed Oct 4, 2024
1 parent 068ac3b commit ead2f03
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions packages/abi/src/matchers/sway-type-matchers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,4 +245,23 @@ describe('sway type matchers', () => {
expect(matcher({ swayType })).toEqual(`${key}-matched`);
verifyOtherMatchersDontMatch(key, swayType);
});

test('str', () => {
const key = 'str';
const swayType = 'str';

expect(matcher({ swayType })).toEqual(`${key}-matched`);
verifyOtherMatchersDontMatch(key, swayType);
});

test('matcher without mapping for valid sway type throws', () => {
const swayType = 'str';

// @ts-expect-error intentionally missing key for valid swayType
const matcherWithoutMappings = createMatcher({});

expect(() => matcherWithoutMappings({ swayType })).toThrow(
`Matcher not found for sway type ${swayType}.`
);
});
});

0 comments on commit ead2f03

Please sign in to comment.