Skip to content

Commit

Permalink
feat(data): add api.users test data
Browse files Browse the repository at this point in the history
  • Loading branch information
Hans Kristian Flaatten committed Jul 3, 2016
1 parent 3275a92 commit fda4717
Show file tree
Hide file tree
Showing 5 changed files with 152 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ Run in this directory:
$ docker-compose up
```

## Usage

### api.users

```js
const users = require('@turbasen/test-data').api.users;
```

Docker is now watching for changes and will run the test suite automatically.

## [MIT lisenced](https://github.com/Turbasen/test-data/blob/master/LICENSE)
61 changes: 61 additions & 0 deletions data/api.users.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
'use strict';

const ObjectID = require('mongodb').ObjectID;

module.exports = [
{
_id: new ObjectID('100000000000000000000000'),
provider: 'FOO',
apps: [
{
_id: new ObjectID('100000000000000000000001'),
name: 'foo_app1',
limit: {
test: 499,
dev: 500,
prod: 5000,
},
key: {
test: 'foo_app1_test',
dev: 'foo_app1_dev',
prod: 'foo_app1_prod',
},
active: true,
},
],
}, {
_id: new ObjectID('200000000000000000000000'),
provider: 'FOO',
apps: [
{
_id: new ObjectID('200000000000000000000001'),
name: 'bar_app1',
limit: {
test: 499,
dev: 500,
prod: 5000,
},
key: {
test: 'bar_app1_test',
dev: 'bar_app1_dev',
prod: 'bar_app1_prod',
},
active: true,
}, {
_id: new ObjectID('200000000000000000000002'),
name: 'bar_app2',
limit: {
test: 499,
dev: 500,
prod: 5000,
},
key: {
test: 'bar_app2_test',
dev: 'bar_app2_dev',
prod: 'bar_app2_prod',
},
active: true,
},
],
},
];
7 changes: 7 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict';

module.exports = {
api: {
users: require('./data/api.users'),
},
};
53 changes: 53 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"name": "@turbasen/test-data",
"version": null,
"description": "Test data for internal Nasjonal Turbase API development",
"main": "index.js",
"files": [
"index.js"
],
"scripts": {
"codacy-coverage": "codacy-coverage",
"cover": "istanbul cover --report lcovonly ./node_modules/.bin/_mocha -- -R spec test.js",
"grunt:watch": "grunt watch",
"lint": "eslint index.js test.js",
"nsp": "nsp check",
"semantic-release": "semantic-release",
"test": "mocha -R tap -b --check-leaks test.js",
"test:watch": "mocha -R progress -b --check-leaks -w test.js",
"greenkeeper-postpublish": "greenkeeper-postpublish"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Turbasen/test-data.git"
},
"keywords": [
"nasjonal turbase",
"turbasen",
"test",
"data"
],
"author": "Hans Kristian Flaatten <[email protected]>",
"license": "MIT",
"bugs": {
"url": "https://github.com/Turbasen/test-data/issues"
},
"homepage": "https://github.com/Turbasen/test-data#readme",
"dependencies": {
"mongodb": "^2.1.18"
},
"devDependencies": {
"codacy-coverage": "^1.1.3",
"eslint": "^2.13.1",
"eslint-config-airbnb-base": "^3.0.1",
"eslint-plugin-import": "^1.10.0",
"greenkeeper-postpublish": "^1.0.0",
"istanbul": "^0.4.4",
"mocha": "^2.5.3",
"nsp": "^2.5.0",
"semantic-release": "^4.3.5"
},
"engines": {
"node": ">=4.0.0"
}
}
23 changes: 23 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'use strict';

const data = require('.');
const assert = require('assert');
const ObjectID = require('mongodb').ObjectID;

describe('data', () => {
it('exports test data', () => {
assert.deepEqual(Object.keys(data), ['api']);
assert.deepEqual(Object.keys(data.api), ['users']);
});
});

describe('api.users', () => {
it('exports api users', () => {
assert(data.api.users instanceof Array);
assert.equal(data.api.users.length, 2);

data.api.users.forEach(user => {
assert(user._id instanceof ObjectID);
});
});
});

0 comments on commit fda4717

Please sign in to comment.