Skip to content

Commit

Permalink
chore: changed test based on comments
Browse files Browse the repository at this point in the history
  • Loading branch information
prisis committed Jan 30, 2022
1 parent 9cdb999 commit 4e05c14
Showing 1 changed file with 9 additions and 30 deletions.
39 changes: 9 additions & 30 deletions test/system.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { afterEach, describe, expect, it } from 'vitest';
import validator from 'validator';
import { faker } from '../dist/cjs';

const seededRuns = [
Expand Down Expand Up @@ -173,7 +174,9 @@ describe('system', () => {

expect(
fileTypes,
`generated common file type should contain one of [${fileTypes}]. Got "${fileType}".`
`generated common file type should contain one of [${fileTypes.join(
','
)}]. Got "${fileType}".`
).toContain(fileType);
});
});
Expand All @@ -196,7 +199,9 @@ describe('system', () => {

expect(
extList,
`generated common file ext should be one of [${extList}]. Got "${fileExt}".`
`generated common file ext should be one of [${extList.join(
','
)}]. Got "${fileExt}".`
).include(fileExt);
});
});
Expand All @@ -214,36 +219,10 @@ describe('system', () => {

describe('semver()', () => {
it('should return semver', () => {
const [firstNumber, secondNumber, thirdNumber] = faker.system
.semver()
.split('.');

expect(
Number(firstNumber),
`generated semver, first number should be between 0 and 9.`
).greaterThanOrEqual(0);
expect(
Number(firstNumber),
faker.system.semver(),
`generated semver, first number should be between 0 and 9.`
).lessThanOrEqual(9);

expect(
Number(secondNumber),
`generated semver, second number should be between 0 and 9.`
).greaterThanOrEqual(0);
expect(
Number(secondNumber),
`generated semver, second number should be between 0 and 9.`
).lessThanOrEqual(9);

expect(
Number(thirdNumber),
`generated semver, third number should be between 0 and 9.`
).greaterThanOrEqual(0);
expect(
Number(thirdNumber),
`generated semver, third number should be between 0 and 9.`
).lessThanOrEqual(9);
).satisfy(validator.isSemVer);
});
});
}
Expand Down

0 comments on commit 4e05c14

Please sign in to comment.