@storyous/common-utils
Advanced tools
Comparing version 10.5.0 to 11.0.0
{ | ||
"name": "@storyous/common-utils", | ||
"version": "10.5.0", | ||
"version": "11.0.0", | ||
"description": "Common utils for storyous microservices", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -36,3 +36,31 @@ # Common JS utils | ||
### 11.0 | ||
apiTestUtil becomes testUtils. New usage: | ||
#### `config/testing.config.json` | ||
```javascript | ||
const testUtils = require('@storyous/common-utils/lib/testUtils'); | ||
module.exports = { | ||
dbUri: testUtils.uniqueDatabase(process.env.MONGODB_URI) // this will generate timestamp-postfixed database name | ||
|| 'mongodb://127.0.0.1:27018/myProjectTesting', | ||
// ...the rest of the config | ||
}; | ||
``` | ||
#### `test/api.js` | ||
```javascript | ||
const testUtils = require('@storyous/common-utils/lib/testUtils'); | ||
const app = require('../app'); // this has to be a function providing Koa function | ||
const config = require('../config'); | ||
testUtils.init({ | ||
app, | ||
cleanDatabaseUrl: config.db.url // this will prune all old testing databases | ||
}); | ||
module.exports = testUtils; | ||
``` | ||
## MongoCachedFetcher | ||
@@ -39,0 +67,0 @@ |
'use strict'; | ||
const { after } = require('mocha'); | ||
const db = require('../lib/models/db'); | ||
const { after } = require('mocha'); | ||
@@ -6,0 +6,0 @@ let connectPromise; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
116531
3091
104