Skip to content
This repository was archived by the owner on Feb 8, 2024. It is now read-only.

Commit 9e0d98a

Browse files
committed
Add simple test
1 parent e8413d1 commit 9e0d98a

4 files changed

Lines changed: 34 additions & 2 deletions

File tree

.babelrc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
{
22
"presets": ["latest"],
3-
"plugins": ["transform-export-extensions", "syntax-trailing-function-commas"]
3+
"plugins": ["transform-export-extensions", "syntax-trailing-function-commas"],
4+
"env": {
5+
"test": {
6+
"presets": ["@ava/stage-4"]
7+
}
8+
}
49
}

lib/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class Maker {
3434
creator(scopedCtx)
3535
this.ctx.scoped[name] = scopedCtx
3636
}
37+
3738
/**
3839
* Add HTTP method listeners to local
3940
* @param {string} method

lib/index.test.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import test from 'ava'
2+
import { createRest } from './index'
3+
4+
test('Base structure', t => {
5+
t.deepEqual(createRest(r => {}), {
6+
before: [],
7+
after: [],
8+
scoped: {},
9+
local: {},
10+
})
11+
})

package.json

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"dev": "nodemon -w lib -w examples -x \"npm run build && node examples/test.js\"",
88
"clean": "rimraf ./dist ./docs",
99
"build": "babel -d ./dist ./lib",
10-
"test": "echo \"Error: no test specified\" && exit 1",
10+
"test": "NODE_ENV=test ava",
1111
"lint": "eslint ./lib",
1212
"docs": "documentation build -f html -o docs",
1313
"deploy:docs": "buildbranch gh-pages docs",
@@ -33,12 +33,15 @@
3333
"ramda": "^0.23.0"
3434
},
3535
"devDependencies": {
36+
"@ava/babel-preset-stage-4": "^1.0.0",
37+
"ava": "^0.19.1",
3638
"babel-cli": "^6.23.0",
3739
"babel-core": "^6.23.1",
3840
"babel-eslint": "^7.1.1",
3941
"babel-plugin-syntax-trailing-function-commas": "^6.22.0",
4042
"babel-plugin-transform-export-extensions": "^6.22.0",
4143
"babel-preset-latest": "^6.22.0",
44+
"babel-register": "^6.24.1",
4245
"buildbranch": "^2.0.0",
4346
"documentation": "^4.0.0-beta.18",
4447
"eslint": "^3.17.0",
@@ -47,5 +50,17 @@
4750
"nodemon": "^1.11.0",
4851
"rimraf": "^2.6.1",
4952
"stringify-object": "^3.2.0"
53+
},
54+
"ava": {
55+
"files": [
56+
"lib/*.test.js"
57+
],
58+
"source": [
59+
"lib/*.js",
60+
"!lib/*.test.js"
61+
],
62+
"require": "babel-register",
63+
"concurrency": 4,
64+
"babel": "inherit"
5065
}
5166
}

0 commit comments

Comments
 (0)