-
Notifications
You must be signed in to change notification settings - Fork 493
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2321 from artilleryio/bernardobridge/add-fake-dat…
…a-plugin-to-types-dynamically feat(schema): add artillery-plugin-fake-data to schema
- Loading branch information
Showing
6 changed files
with
62 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const Joi = require('joi'); | ||
const falso = require('@ngneat/falso'); | ||
const { getFalsoFunctions } = require('artillery-plugin-fake-data'); | ||
|
||
const buildFalsoObject = () => { | ||
let falsoJoiObject = {}; | ||
|
||
for (let funcName of getFalsoFunctions()) { | ||
falsoJoiObject[funcName] = Joi.object() | ||
.meta({ title: `Falso Function: ${funcName}` }) | ||
.description( | ||
'For information on what parameters this function takes, check the falso documentation: https://ngneat.github.io/falso/docs/getting-started' | ||
); | ||
} | ||
|
||
return falsoJoiObject; | ||
}; | ||
|
||
const FakeDataPlugin = Joi.object({ | ||
...buildFalsoObject() | ||
}) | ||
.unknown(false) | ||
.meta({ title: 'Fake Data Plugin' }) | ||
.description( | ||
'This plugin adds access to random realistic test data generation using falso. You can configure the parameters of each function in the config. \nFor more information, check our documentation: https://www.artillery.io/docs/reference/extensions/fake-data' | ||
); | ||
|
||
module.exports = { | ||
FakeDataPlugin | ||
}; |