Skip to content

Commit

Permalink
fix: minor spelling errors (#2225)
Browse files Browse the repository at this point in the history
* fix: minor spelling errors

* yarn changeset
  • Loading branch information
dustin-engstrom committed Feb 20, 2024
1 parent 18afd81 commit cefb205
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 15 deletions.
5 changes: 5 additions & 0 deletions .changeset/rude-owls-cheer.md
@@ -0,0 +1,5 @@
---
'graphql-scalars': patch
---

fix minor misspellings
2 changes: 1 addition & 1 deletion src/scalars/RoutingNumber.ts
Expand Up @@ -48,7 +48,7 @@ const validate = (value: unknown, ast?: ASTNode) => {
}

if (!checksum(rtn)) {
throw createGraphQLError("checksum doens't match", ast ? { nodes: ast } : undefined);
throw createGraphQLError("checksum doesn't match", ast ? { nodes: ast } : undefined);
}

return rtn;
Expand Down
18 changes: 11 additions & 7 deletions tests/AccountNumber.test.ts
@@ -1,8 +1,8 @@
import { GraphQLAccountNumber } from '../src/scalars/AccountNumber.js';
import { Kind } from 'graphql';
import { GraphQLAccountNumber } from '../src/scalars/AccountNumber.js';

const invalids = [
['greather than 17', '123456789123456789'],
['greater than 17', '123456789123456789'],
['less than 5', '1234'],
['special character', '1234a$'],
['special character', '12345_'],
Expand All @@ -19,7 +19,7 @@ describe('ABA Routing Number', () => {
GraphQLAccountNumber.parseLiteral({
kind: Kind.INT,
value: '' + value,
})
}),
).toThrow(/can only parse String/);

expect(() => GraphQLAccountNumber.serialize(value)).toThrow(/can only parse String/);
Expand All @@ -32,12 +32,16 @@ describe('ABA Routing Number', () => {
GraphQLAccountNumber.parseLiteral({
kind: Kind.STRING,
value: routingNumber,
})
}),
).toThrow(/must be alphanumeric between 5-17/);

expect(() => GraphQLAccountNumber.parseValue(routingNumber)).toThrow(/must be alphanumeric between 5-17/);
expect(() => GraphQLAccountNumber.parseValue(routingNumber)).toThrow(
/must be alphanumeric between 5-17/,
);

expect(() => GraphQLAccountNumber.serialize(routingNumber)).toThrow(/must be alphanumeric between 5-17/);
expect(() => GraphQLAccountNumber.serialize(routingNumber)).toThrow(
/must be alphanumeric between 5-17/,
);
});
});

Expand All @@ -49,7 +53,7 @@ describe('ABA Routing Number', () => {
GraphQLAccountNumber.parseLiteral({
kind: Kind.STRING,
value: routing,
})
}),
).toBe(routing);
});
});
Expand Down
14 changes: 7 additions & 7 deletions tests/RoutingNumber.test.ts
@@ -1,11 +1,11 @@
import { GraphQLRoutingNumber } from '../src/scalars/RoutingNumber.js';
import { Kind } from 'graphql';
import { GraphQLRoutingNumber } from '../src/scalars/RoutingNumber.js';

const invalids: [string, string | number, RegExp][] = [
['less than 9 digits', '11100009', /must have nine digits/],
['greather than 9 digits', '1110000250', /must have nine digits/],
["checksum doens't match", '111000024', /checksum doens't match/],
["all 1's", '111111111', /checksum doens't match/],
['greater than 9 digits', '1110000250', /must have nine digits/],
["checksum doesn't match", '111000024', /checksum doesn't match/],
["all 1's", '111111111', /checksum doesn't match/],
['special character', '11100002$', /must have nine digits/],
['alphabetic character', '11100002a', /must have nine digits/],
['negative number', -111000025, /must have nine digits/],
Expand All @@ -22,7 +22,7 @@ describe('ABA Routing Number', () => {
GraphQLRoutingNumber.parseLiteral({
kind: Kind.FLOAT,
value: '' + value,
})
}),
).toThrow(/can only parse Integer or String/);

expect(() => GraphQLRoutingNumber.serialize(value)).toThrow(/must be integer or string/);
Expand All @@ -35,7 +35,7 @@ describe('ABA Routing Number', () => {
GraphQLRoutingNumber.parseLiteral({
kind: typeof routingNumber === 'string' ? Kind.STRING : Kind.INT,
value: '' + routingNumber,
})
}),
).toThrow(reason);

expect(() => GraphQLRoutingNumber.parseValue(routingNumber)).toThrow(reason);
Expand All @@ -53,7 +53,7 @@ describe('ABA Routing Number', () => {
GraphQLRoutingNumber.parseLiteral({
kind: Kind.STRING,
value: '' + routing,
})
}),
).toBe(parsed);
});
});
Expand Down

0 comments on commit cefb205

Please sign in to comment.