Skip to content

Commit

Permalink
test: add basic tests for exported module (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
zeke authored May 5, 2020
1 parent aaf0690 commit 7960b59
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"scripts": {
"pretest": "standard",
"test": "node bin/octokit-webhooks.js check --cached"
"test": "node bin/octokit-webhooks.js check --cached && node test.js"
},
"repository": "https://github.com/octokit/webhooks",
"keywords": [],
Expand Down
11 changes: 11 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const assert = require('assert')
const webhooks = require('.')

assert(Array.isArray(webhooks), 'webhooks module should export an array')
assert(webhooks.length > 0, 'webhooks module array is not empty')

webhooks.forEach(webhook => {
assert(typeof webhook.name === 'string')
assert(Array.isArray(webhook.actions))
assert(Array.isArray(webhook.examples))
})

0 comments on commit 7960b59

Please sign in to comment.