YAML API testing library
npm install flekkLow code testing library. Test your APIs using only YAML.
```
npm i -g flekk
All test and setup files live in the $APP_ROOT/test directory, and written with weblang.
Test files must en with .test.yml, for example project.test.yml. Setup files, which can be included in test files, must end with .setup.yml, like in login.setup.yml.
Config files must end in .config.yml, like in app.config.yml.
The default config file should be added in $APP_ROOT/test/flekk.config.yml:`ymlThe URL and port of the app you are testing
url: http://localhost
port: 5061
The default config file is always loaded, and then other config files are merged on top of that.
$3
There are 6 basic commands:
* __config__ - load config files
* __setup__ - run setup files
* __api__ - query an action endpoint
* __db__ - access the database
* __test__ - test a value
* __log__ - log a value to console
This is how to use them:
`yml
Load config file
@config: appLoad multiple config files, will be merged
@config:
- app
- remoteRun setup file
@setup: loginRun multiple setup files
@setup:
- create-user
- loginTest the site/create API
@api$result:
action: site/create
values:
name: hello
auth: $auth
@test$result:
id:
is: idTest database values
@db$site:
action: site/get
query:
id: $result.id
@test$site:
id:
required: truePrint value to terminal
$hello: world
log: $hello
`$3
Run the tests with:
`
Run all tests
flekkRun matching tests
flekk namesWith nodemon
nodemon -e js,mjs,json,yml,css,md --exec flekk
`Add this to you
package.json file to run with npm:
`json
"scripts": {
"test": "nodemon -q -e js,mjs,json,yml,css,md --exec flekk"
}
`
Then run with npm run test` in your application.MIT Licensed. Enjoy!