Skip to content

Commit

Permalink
Merge branch 'next' into za-cities
Browse files Browse the repository at this point in the history
  • Loading branch information
ST-DDT committed May 9, 2023
2 parents 5bc55b1 + aab69c9 commit 1abbde6
Show file tree
Hide file tree
Showing 16 changed files with 213 additions and 170 deletions.
9 changes: 8 additions & 1 deletion .eslintrc.js
Expand Up @@ -29,10 +29,12 @@ module.exports = defineConfig({
rules: {
// We may want to use this in the future
'no-useless-escape': 'off',
'deprecation/deprecation': 'error',
eqeqeq: ['error', 'always', { null: 'ignore' }],
'no-else-return': 'error',
'prefer-template': 'error',

'deprecation/deprecation': 'error',

'@typescript-eslint/array-type': [
'error',
{ default: 'array-simple', readonly: 'generic' },
Expand Down Expand Up @@ -112,8 +114,10 @@ module.exports = defineConfig({
},
{
files: ['test/*.spec.ts'],
extends: ['plugin:vitest/recommended'],
rules: {
'deprecation/deprecation': 'off',

'@typescript-eslint/restrict-template-expressions': [
'error',
{
Expand All @@ -122,6 +126,9 @@ module.exports = defineConfig({
allowAny: true,
},
],

'vitest/expect-expect': 'off',
'vitest/valid-expect': ['error', { maxArgs: 2 }],
},
},
],
Expand Down
7 changes: 4 additions & 3 deletions package.json
Expand Up @@ -104,8 +104,8 @@
"@types/validator": "~13.7.16",
"@typescript-eslint/eslint-plugin": "~5.59.2",
"@typescript-eslint/parser": "~5.59.2",
"@vitest/coverage-c8": "~0.30.1",
"@vitest/ui": "~0.30.1",
"@vitest/coverage-c8": "~0.31.0",
"@vitest/ui": "~0.31.0",
"@vueuse/core": "~10.1.2",
"c8": "~7.13.0",
"conventional-changelog-cli": "~2.2.2",
Expand All @@ -118,6 +118,7 @@
"eslint-plugin-deprecation": "~1.4.1",
"eslint-plugin-jsdoc": "~44.0.0",
"eslint-plugin-prettier": "~4.2.1",
"eslint-plugin-vitest": "~0.2.2",
"glob": "~10.2.2",
"npm-run-all": "~4.1.5",
"picocolors": "~1.0.0",
Expand All @@ -135,7 +136,7 @@
"validator": "~13.9.0",
"vite": "~4.3.5",
"vitepress": "1.0.0-alpha.75",
"vitest": "~0.30.1",
"vitest": "~0.31.0",
"vue": "~3.2.47"
},
"packageManager": "pnpm@8.4.0",
Expand Down
122 changes: 82 additions & 40 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions test/all_functional.spec.ts
Expand Up @@ -138,7 +138,7 @@ describe('BROKEN_LOCALE_METHODS test', () => {
});

Object.keys(modules).forEach((module) => {
describe(module, () => {
describe(`${module}`, () => {
it('should not contain obsolete configuration (methods)', () => {
const existingMethods = modules[module];
const configuredMethods = Object.keys(
Expand All @@ -157,14 +157,14 @@ describe('BROKEN_LOCALE_METHODS test', () => {

describe('functional tests', () => {
for (const [locale, faker] of Object.entries(allFakers)) {
describe(locale, () => {
describe(`${locale}`, () => {
if (locale === 'base') {
it.skip('base locale is checked by other tests');
return;
}

Object.keys(modules).forEach((module) => {
describe(module, () => {
describe(`${module}`, () => {
modules[module].forEach((meth) => {
const testAssertion = () => {
// TODO @ST-DDT 2022-03-28: Use random seed once there are no more failures
Expand Down Expand Up @@ -195,14 +195,14 @@ describe('functional tests', () => {

describe('faker.helpers.fake functional tests', () => {
for (const [locale, faker] of Object.entries(allFakers)) {
describe(locale, () => {
describe(`${locale}`, () => {
if (locale === 'base') {
it.skip('base locale is checked by other tests');
return;
}

Object.keys(modules).forEach((module) => {
describe(module, () => {
describe(`${module}`, () => {
modules[module].forEach((meth) => {
const testAssertion = () => {
// TODO @ST-DDT 2022-03-28: Use random seed once there are no more failures
Expand Down
6 changes: 2 additions & 4 deletions test/commerce.spec.ts
Expand Up @@ -110,16 +110,14 @@ describe('commerce', () => {
const price = faker.commerce.price(100, 100, 1);

expect(price).toBeTruthy();
expect(price, 'the price should be equal 100.0').toStrictEqual(
'100.0'
);
expect(price, 'the price should be equal 100.0').toBe('100.0');
});

it('should handle argument dec = 0', () => {
const price = faker.commerce.price(100, 100, 0);

expect(price).toBeTruthy();
expect(price, 'the price should be equal 100').toStrictEqual('100');
expect(price, 'the price should be equal 100').toBe('100');
});
});

Expand Down
6 changes: 4 additions & 2 deletions test/datatype.spec.ts
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
import { faker } from '../src';
import { faker, FakerError } from '../src';
import { seededTests } from './support/seededRuns';

const NON_SEEDED_BASED_RUN = 25;
Expand Down Expand Up @@ -226,7 +226,9 @@ describe('datatype', () => {

expect(() => {
faker.datatype.number({ min, max });
}).toThrowError(`Max ${max} should be greater than min ${min}.`);
}).toThrow(
new FakerError(`Max ${max} should be greater than min ${min}.`)
);
});
});

Expand Down

0 comments on commit 1abbde6

Please sign in to comment.