Skip to content

Commit

Permalink
fix: remove doubled extension in system.filePath (#300)
Browse files Browse the repository at this point in the history
  • Loading branch information
pkuczynski committed Mar 29, 2022
1 parent 1bb0f25 commit 2532eb9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
5 changes: 3 additions & 2 deletions src/system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,11 @@ export class System {
* Returns a file path.
*
* @example
* faker.system.filePath() // '/usr/local/src/money.rmp.dotx'
* faker.system.filePath() // '/usr/local/src/money.dotx'
*/
// TODO @prisis 2022-01-25: add a parameter to have the possibility to have one or two ext on file.
filePath(): string {
return `${this.faker.system.directoryPath()}/${this.faker.system.fileName()}.${this.faker.system.fileExt()}`;
return `${this.directoryPath()}/${this.fileName()}`;
}

/**
Expand Down
12 changes: 4 additions & 8 deletions test/system.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ const seededRuns = [
fileType: 'image',
fileExt: 'chm',
directoryPath: '/opt/bin',
// TODO @prisis 2022-01-25: add a parameter to have the possibility to have one or two ext on file.
filePath: '/opt/bin/directives_savings_computer.qwd.jade',
filePath: '/opt/bin/directives_savings_computer.qwd',
semver: '3.7.9',
},
},
Expand All @@ -31,8 +30,7 @@ const seededRuns = [
fileType: 'font',
fileExt: 'gxt',
directoryPath: '/Library',
// TODO @prisis 2022-01-25: add a parameter to have the possibility to have one or two ext on file.
filePath: '/Library/bike_kiribati.kpr.ez3',
filePath: '/Library/bike_kiribati.kpr',
semver: '2.5.1',
},
},
Expand All @@ -47,8 +45,7 @@ const seededRuns = [
fileType: 'x-shader',
fileExt: 'opml',
directoryPath: '/var/log',
// TODO @prisis 2022-01-25: add a parameter to have the possibility to have one or two ext on file.
filePath: '/var/log/forward_frozen.swf.fcdt',
filePath: '/var/log/forward_frozen.swf',
semver: '9.4.8',
},
},
Expand Down Expand Up @@ -104,7 +101,6 @@ describe('system', () => {
'jpeg',
'm2a',
'm2v',
'm3a',
'mp4',
'mp4v',
'mpeg',
Expand All @@ -118,7 +114,7 @@ describe('system', () => {
expect(
extList,
`generated common file ext should be one of [${extList.join(
','
', '
)}]. Got "${fileExt}".`
).include(fileExt);
});
Expand Down

0 comments on commit 2532eb9

Please sign in to comment.