Skip to content

Commit

Permalink
Fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
alcuadrado committed Jul 9, 2024
1 parent e95f5ec commit 250cd29
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions v-next/hardhat-test-utils/src/hardhat-error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import { ensureError } from "@ignored/hardhat-vnext-utils/error";
* arguments.
*
* @param error The error.
* @param descritor The error descriptor.
* @param descriptor The error descriptor.
* @param messageArguments The message arguments.
*/
export function assertIsHardhatError<ErrorDescriptorT extends ErrorDescriptor>(
error: unknown,
descritor: ErrorDescriptorT,
descriptor: ErrorDescriptorT,
messageArguments: HardhatError<ErrorDescriptorT>["messageArguments"],
): asserts error is HardhatError<ErrorDescriptorT> {
assert.ok(HardhatError.isHardhatError(error), "Error is not a HardhatError");
Expand All @@ -24,11 +24,11 @@ export function assertIsHardhatError<ErrorDescriptorT extends ErrorDescriptor>(
// in case the descriptors are different.
assert.equal(
error.descriptor.number,
descritor.number,
`Expected error number ${descritor.number}, but got ${error.descriptor.number}`,
descriptor.number,
`Expected error number ${descriptor.number}, but got ${error.descriptor.number}`,
);

assert.deepEqual(error.descriptor, descritor);
assert.deepEqual(error.descriptor, descriptor);

assert.deepEqual(error.messageArguments, messageArguments);
}
Expand All @@ -38,21 +38,21 @@ export function assertIsHardhatError<ErrorDescriptorT extends ErrorDescriptor>(
* descriptor and message arguments.
*
* @param f The function that should throw.
* @param descritor The error descriptor.
* @param descriptor The error descriptor.
* @param messageArguments The message arguments.
*/
export function assertThrowsHardhatError<
ErrorDescriptorT extends ErrorDescriptor,
>(
f: () => any,
descritor: ErrorDescriptorT,
descriptor: ErrorDescriptorT,
messageArguments: HardhatError<ErrorDescriptorT>["messageArguments"],
): void {
try {
f();
} catch (error) {
ensureError(error);
assertIsHardhatError(error, descritor, messageArguments);
assertIsHardhatError(error, descriptor, messageArguments);

return;
}
Expand All @@ -66,14 +66,14 @@ export function assertThrowsHardhatError<
* arguments.
*
* @param op The async operation. If it's a function, it's called and awaited.
* @param descritor The error descriptor.
* @param descriptor The error descriptor.
* @param messageArguments The message arguments.
*/
export async function assertRejectsWithHardhatError<
ErrorDescriptorT extends ErrorDescriptor,
>(
op: (() => Promise<any>) | Promise<any>,
descritor: ErrorDescriptorT,
descriptor: ErrorDescriptorT,
messageArguments: HardhatError<ErrorDescriptorT>["messageArguments"],
): Promise<void> {
try {
Expand All @@ -84,7 +84,7 @@ export async function assertRejectsWithHardhatError<
}
} catch (error) {
ensureError(error);
assertIsHardhatError(error, descritor, messageArguments);
assertIsHardhatError(error, descriptor, messageArguments);

return;
}
Expand Down

0 comments on commit 250cd29

Please sign in to comment.