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

test: remove duplicate fixed-seeded-tests #1653

Merged
merged 4 commits into from
Dec 13, 2022
Merged
Show file tree
Hide file tree
Changes from 3 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
72 changes: 0 additions & 72 deletions test/__snapshots__/system.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -239,75 +239,3 @@ exports[`system > 1337 > networkInterface > with {"interfaceType":"ww"} 1`] = `"
exports[`system > 1337 > networkInterface > with {} 1`] = `"enx234870538945"`;

exports[`system > 1337 > semver 1`] = `"2.5.1"`;

exports[`system > seed: 42 > commonFileExt() 1`] = `"png"`;

exports[`system > seed: 42 > commonFileName() 1`] = `"nonbeliever_stub.png"`;

exports[`system > seed: 42 > commonFileType() 1`] = `"audio"`;

exports[`system > seed: 42 > cron() 1`] = `"* 19 * 3 5"`;

exports[`system > seed: 42 > directoryPath() 1`] = `"/opt/bin"`;

exports[`system > seed: 42 > fileExt() 1`] = `"lrm"`;

exports[`system > seed: 42 > fileName() 1`] = `"nonbeliever_stub.skt"`;

exports[`system > seed: 42 > filePath() 1`] = `"/opt/bin/crowded_fail_woefully.dra"`;

exports[`system > seed: 42 > fileType() 1`] = `"image"`;

exports[`system > seed: 42 > mimeType() 1`] = `"application/vnd.ibm.rights-management"`;

exports[`system > seed: 42 > networkInterface() 1`] = `"wlp1s7"`;

exports[`system > seed: 42 > semver() 1`] = `"3.7.9"`;

exports[`system > seed: 1211 > commonFileExt() 1`] = `"htm"`;

exports[`system > seed: 1211 > commonFileName() 1`] = `"although_instantly_though.gif"`;

exports[`system > seed: 1211 > commonFileType() 1`] = `"application"`;

exports[`system > seed: 1211 > cron() 1`] = `"55 * 28 * 1"`;

exports[`system > seed: 1211 > directoryPath() 1`] = `"/var/log"`;

exports[`system > seed: 1211 > fileExt() 1`] = `"dic"`;

exports[`system > seed: 1211 > fileName() 1`] = `"although_instantly_though.ustar"`;

exports[`system > seed: 1211 > filePath() 1`] = `"/var/log/outside_even.xhvml"`;

exports[`system > seed: 1211 > fileType() 1`] = `"x-shader"`;

exports[`system > seed: 1211 > mimeType() 1`] = `"text/vnd.dmclientscript"`;

exports[`system > seed: 1211 > networkInterface() 1`] = `"wws8d1"`;

exports[`system > seed: 1211 > semver() 1`] = `"9.4.8"`;

exports[`system > seed: 1337 > commonFileExt() 1`] = `"wav"`;

exports[`system > seed: 1337 > commonFileName() 1`] = `"although.wav"`;

exports[`system > seed: 1337 > commonFileType() 1`] = `"audio"`;

exports[`system > seed: 1337 > cron() 1`] = `"15 13 5 * *"`;

exports[`system > seed: 1337 > directoryPath() 1`] = `"/Library"`;

exports[`system > seed: 1337 > fileExt() 1`] = `"oa3"`;

exports[`system > seed: 1337 > fileName() 1`] = `"although.chrt"`;

exports[`system > seed: 1337 > filePath() 1`] = `"/Library/yum_fast.aiff"`;

exports[`system > seed: 1337 > fileType() 1`] = `"font"`;

exports[`system > seed: 1337 > mimeType() 1`] = `"application/vnd.chipnuts.karaoke-mmd"`;

exports[`system > seed: 1337 > networkInterface() 1`] = `"enx234870538945"`;

exports[`system > seed: 1337 > semver() 1`] = `"2.5.1"`;
33 changes: 2 additions & 31 deletions test/system.spec.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,11 @@
import validator from 'validator';
import { afterEach, describe, expect, it } from 'vitest';
import { faker } from '../src';
import { seededRuns, seededTests } from './support/seededRuns';
import { seededTests } from './support/seededRuns';
import { times } from './support/times';

const NON_SEEDED_BASED_RUN = 5;

const functionNames = [
'commonFileExt',
'commonFileName',
'commonFileType',
'cron',
'directoryPath',
'fileExt',
'fileName',
'filePath',
'fileType',
'mimeType',
'networkInterface',
'semver',
];

describe('system', () => {
afterEach(() => {
faker.locale = 'en';
Expand Down Expand Up @@ -80,20 +65,6 @@ describe('system', () => {
});
});

for (const seed of seededRuns) {
describe(`seed: ${seed}`, () => {
for (const functionName of functionNames) {
it(`${functionName}()`, () => {
faker.seed(seed);

const actual = faker.system[functionName]();

expect(actual).toMatchSnapshot();
});
}
});
}

describe(`random seeded tests for seed ${faker.seed()}`, () => {
for (let i = 1; i <= NON_SEEDED_BASED_RUN; i++) {
describe('commonFileExt()', () => {
Expand Down Expand Up @@ -437,7 +408,7 @@ describe('system', () => {
);

it('should return non-standard cron expressions', () => {
const validResults = ['1', '2', '3', '4', '5', '*', '@'];
const validResults = ['1', '2', '3', '4', '5', '6', '*', '@'];
expect(
faker.system.cron({ includeNonStandard: true })[0],
'generated cron, string should contain non-standard cron labels'
Expand Down