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

infra(vitest): no-alias-methods #2899

Merged
merged 3 commits into from
May 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ module.exports = defineConfig({
],

'vitest/expect-expect': 'off',
'vitest/no-alias-methods': 'error',
'vitest/prefer-each': 'error',
'vitest/prefer-to-have-length': 'error',
'vitest/valid-expect': ['error', { maxArgs: 2 }],
Expand Down
16 changes: 8 additions & 8 deletions test/modules/helpers-eval.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import { fakeEval } from '../../src/modules/helpers/eval';

describe('fakeEval()', () => {
it('does not allow empty string input', () => {
expect(() => fakeEval('', faker)).toThrowError(
expect(() => fakeEval('', faker)).toThrow(
new FakerError('Eval expression cannot be empty.')
);
});

it('does not allow empty entrypoints', () => {
expect(() => fakeEval('foobar', faker, [])).toThrowError(
expect(() => fakeEval('foobar', faker, [])).toThrow(
new FakerError('Eval entrypoints cannot be empty.')
);
});
Expand Down Expand Up @@ -116,7 +116,7 @@ describe('fakeEval()', () => {
});

it('requires a dot after a function call', () => {
expect(() => fakeEval('airline.airline()iataCode', faker)).toThrowError(
expect(() => fakeEval('airline.airline()iataCode', faker)).toThrow(
new FakerError(
"Expected dot ('.'), open parenthesis ('('), or nothing after function call but got 'i'"
)
Expand All @@ -140,22 +140,22 @@ describe('fakeEval()', () => {
});

it('requires a valid expression (trailing dot)', () => {
expect(() => fakeEval('airline.airline.', faker)).toThrowError(
expect(() => fakeEval('airline.airline.', faker)).toThrow(
new FakerError("Found dot without property name in 'airline.'")
);
expect(() => fakeEval('airline.airline.()', faker)).toThrowError(
expect(() => fakeEval('airline.airline.()', faker)).toThrow(
new FakerError("Found dot without property name in 'airline.()'")
);
expect(() => fakeEval('airline.airline.().iataCode', faker)).toThrowError(
expect(() => fakeEval('airline.airline.().iataCode', faker)).toThrow(
new FakerError("Found dot without property name in 'airline.().iataCode'")
);
});

it('requires a valid expression (unclosed parenthesis)', () => {
expect(() => fakeEval('airline.airline(', faker)).toThrowError(
expect(() => fakeEval('airline.airline(', faker)).toThrow(
new FakerError("Missing closing parenthesis in '('")
);
expect(() => fakeEval('airline.airline(.iataCode', faker)).toThrowError(
expect(() => fakeEval('airline.airline(.iataCode', faker)).toThrow(
new FakerError("Missing closing parenthesis in '(.iataCode'")
);
});
Expand Down