aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr Kuczynski <[email protected]>2022-03-29 18:16:41 +0200
committerGitHub <[email protected]>2022-03-29 18:16:41 +0200
commit2532eb9f5a6f73bbc1786ec91952f838d98fd72a (patch)
tree3534457daa59ea1646a1f1bb1577006309d6b369
parent1bb0f25d058e6a9f7c1331252f33c80fa3039f61 (diff)
downloadfaker-2532eb9f5a6f73bbc1786ec91952f838d98fd72a.tar.xz
faker-2532eb9f5a6f73bbc1786ec91952f838d98fd72a.zip
fix: remove doubled extension in system.filePath (#300)
-rw-r--r--src/system.ts5
-rw-r--r--test/system.spec.ts12
2 files changed, 7 insertions, 10 deletions
diff --git a/src/system.ts b/src/system.ts
index c6532ed2..c5b052c0 100644
--- a/src/system.ts
+++ b/src/system.ts
@@ -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()}`;
}
/**
diff --git a/test/system.spec.ts b/test/system.spec.ts
index b9d36edc..e9eee506 100644
--- a/test/system.spec.ts
+++ b/test/system.spec.ts
@@ -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',
},
},
@@ -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',
},
},
@@ -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',
},
},
@@ -104,7 +101,6 @@ describe('system', () => {
'jpeg',
'm2a',
'm2v',
- 'm3a',
'mp4',
'mp4v',
'mpeg',
@@ -118,7 +114,7 @@ describe('system', () => {
expect(
extList,
`generated common file ext should be one of [${extList.join(
- ','
+ ', '
)}]. Got "${fileExt}".`
).include(fileExt);
});