Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unit tests #12

Merged
merged 11 commits into from
Feb 28, 2020
Merged

Add unit tests #12

merged 11 commits into from
Feb 28, 2020

Conversation

smithki
Copy link
Contributor

@smithki smithki commented Feb 27, 2020

Fixes #8

Screen Shot 2020-02-27 at 2 07 58 PM

Screen Shot 2020-02-27 at 2 08 26 PM

@smithki smithki requested a review from Dizigen February 27, 2020 01:02
@smithki smithki self-assigned this Feb 27, 2020
@smithki smithki marked this pull request as ready for review February 27, 2020 21:06
Comment on lines -43 to -66
export function createInvalidArgumentError(options: {
functionName: string;
argIndex: number;
expected: string;
received: string;
}) {
const ordinalSuffix = (i: number) => {
const iAdjusted = i + 1; // Argument is zero-indexed.
const j = iAdjusted % 10;
const k = iAdjusted % 100;
if (j === 1 && k !== 11) return `${iAdjusted}st`;
if (j === 2 && k !== 12) return `${iAdjusted}nd`;
if (j === 3 && k !== 13) return `${iAdjusted}rd`;
return `${iAdjusted}th`;
};

return new MagicSDKError(
ErrorCode.InvalidArgument,
`Invalid ${ordinalSuffix(options.argIndex)} argument given to \`${options.functionName}\`.\n` +
` Expected: \`${options.expected}\`\n` +
` Received: \`${options.received}\``,
);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed this because it is unused at the moment.

@smithki smithki merged commit c9debe3 into master Feb 28, 2020
@FYJen FYJen deleted the smithki_unit_tests branch April 17, 2020 19:06
@smithki
Copy link
Contributor Author

smithki commented Oct 22, 2020

@smithki smithki added the released This issue/pull request has been released. label Oct 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[M6] Add unit-test coverage
2 participants