Skip to content

Commit

Permalink
chore: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pkuczynski committed Apr 6, 2022
1 parent 4edadf2 commit 1cddd1b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions test/system.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import validator from 'validator';
import { afterEach, describe, expect, it } from 'vitest';
import { faker } from '../src';
import { faker, FakerError } from '../src';

const seededRuns = [
{
Expand Down Expand Up @@ -251,19 +251,25 @@ describe('system', () => {
});

it('should not have extension when ext=0', () => {
const filePath = faker.system.filePath(0);
const filePath = faker.system.filePath({ ext: 0 });
const file = filePath.split('/').pop();

expect(file.includes('.')).toBeFalsy();
});

it('should have multiple extension when ext > 1', () => {
const ext = 3;
const filePath = faker.system.filePath(ext);
const filePath = faker.system.filePath({ ext });
const file = filePath.split('/').pop();

expect(file.split('.').length).toBe(ext + 1);
});

it('should throw error ext < 0', () => {
expect(() => faker.system.filePath({ ext: -1 })).toThrow(
new FakerError('Options.ext shall not have negative value')
);
});
});

describe('mimeType()', () => {
Expand Down

0 comments on commit 1cddd1b

Please sign in to comment.