aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorST-DDT <[email protected]>2022-04-03 15:57:40 +0200
committerGitHub <[email protected]>2022-04-03 15:57:40 +0200
commit52ad16ebe424cfe1acf7be1e98c9671baf8d1576 (patch)
tree5f6c489d35c3cbcee302a5275670d55106530a2c
parentb40121e9102b9e8bde1d99689bd2fd3f61f8b767 (diff)
downloadfaker-52ad16ebe424cfe1acf7be1e98c9671baf8d1576.tar.xz
faker-52ad16ebe424cfe1acf7be1e98c9671baf8d1576.zip
test: check that system.filePath() generates file extensions (#765)
-rw-r--r--test/system.spec.ts7
1 files changed, 5 insertions, 2 deletions
diff --git a/test/system.spec.ts b/test/system.spec.ts
index e3e7f692..de7d0390 100644
--- a/test/system.spec.ts
+++ b/test/system.spec.ts
@@ -2,7 +2,6 @@ import validator from 'validator';
import { afterEach, describe, expect, it } from 'vitest';
import { faker } from '../src';
-// TODO @prisis 2022-01-31: Add multiple seed based expectations.
const seededRuns = [
{
seed: 42,
@@ -235,12 +234,16 @@ describe('system', () => {
describe('filePath()', () => {
it('should return unix fs file full path', () => {
const filePath = faker.system.filePath();
+ const parts = filePath.split('/');
expect(
filePath.startsWith('/'),
'generated filePath should start with /'
).toBeTruthy();
- // TODO @prisis 2022-01-26: Add test to validate if the path has ext on the end.
+ expect(
+ parts[parts.length - 1],
+ 'generated filePath should have a file extension'
+ ).toMatch(/^\w+\.\w+$/);
});
});