Skip to content

Commit

Permalink
chore(quality): best practice
Browse files Browse the repository at this point in the history
  • Loading branch information
MrAntix committed Feb 2, 2024
1 parent 30e5afb commit 76f6f56
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions src/parsing/dates/dates-equals.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,19 @@ describe('dates-equals', () => {
});

describe('not', () => {
const parser = Is.date.not.equals('2000-01-01');
const notParser = Is.date.not.equals('2000-01-01');

it('success', () => {
const value = parseDate('3000-01-01');
const result = parser.parse(value);
const result = notParser.parse(value);

expect(result.errors).toEqual(ParseErrors.empty);
expect(result.value).toEqual(value);
});

it('failure', () => {
const value = parseDate('2000-01-01');
const result = parser.parse(value);
const result = notParser.parse(value);

expect(result.errors).toEqual(ParseErrors.not(ParseErrors.equals(value)));
expect(result.value).toEqual(value);
Expand Down
4 changes: 2 additions & 2 deletions src/parsing/json/IJson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export namespace IJson {

export interface Parser<T = unknown> extends IParser<T> {

readonly for: <T>(schema: ComplexSchema<T>) => IComplex.Parser<T>;
readonly use: <T>(parser: IParser<T>) => IParser<T>;
readonly for: <U>(schema: ComplexSchema<U>) => IComplex.Parser<U>;
readonly use: <U>(parser: IParser<U>) => IParser<U>;
}
}
6 changes: 3 additions & 3 deletions src/parsing/numbers/numbers-float-anyOf.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ describe('numbers-float-anyOf', () => {
});

describe('not', () => {
const parser = Is.float.not.anyOf(anyOf);
const notParser = Is.float.not.anyOf(anyOf);

it('success', () => {
const value = 1;
const result = parser.parse(value);
const result = notParser.parse(value);

expect(result.errors).toEqual(ParseErrors.empty);
expect(result.value).toEqual(value);
});

it('failure', () => {
const value = anyOf[0];
const result = parser.parse(value);
const result = notParser.parse(value);

expect(result.errors).toEqual(ParseErrors.not(ParseErrors.anyOf(anyOf)));
expect(result.value).toEqual(value);
Expand Down
6 changes: 3 additions & 3 deletions src/parsing/numbers/numbers-float-equals.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,19 @@ describe('numbers-float-equals', () => {
});

describe('not', () => {
const parser = Is.float.not.equals(10);
const notParser = Is.float.not.equals(10);

it('success', () => {
const value = 9;
const result = parser.parse(value);
const result = notParser.parse(value);

expect(result.errors).toEqual(ParseErrors.empty);
expect(result.value).toEqual(value);
});

it('failure', () => {
const value = 10;
const result = parser.parse(value);
const result = notParser.parse(value);

expect(result.errors).toEqual(ParseErrors.not(ParseErrors.equals(value)));
expect(result.value).toEqual(value);
Expand Down
4 changes: 2 additions & 2 deletions src/parsing/strings/strings-equals.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ describe('strings-equals', () => {
});

it('success ignore case', () => {
const parser = Is.string.equals(expectedValue, true);
const ignoreCaseParser = Is.string.equals(expectedValue, true);
const value = expectedValue.toUpperCase();
const result = parser.parse(value);
const result = ignoreCaseParser.parse(value);

expect(result.errors).toEqual(ParseErrors.empty);
expect(result.value).toEqual(value);
Expand Down

0 comments on commit 76f6f56

Please sign in to comment.