Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Wip] test #63

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ function cmdGet (msg, done) {

Request.get({url: registry, gzip: true}, (err, res, body) => {
if (err) return done(err)
console.log(JSON.stringify(body))

var data = JSON.parse(body)
var distTags = data['dist-tags'] || {}
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"scripts": {
"start": "node srv/start.js",
"isolated": "GITHUB_ISOLATED=true node srv/start.js",
"lint": "lab test -dL"
"lint": "lab test -dL",
"test": "lab"
},
"main": "lib/github.js",
"keywords": [
Expand Down
11 changes: 8 additions & 3 deletions test/github.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var describe = lab.describe
var it = lab.it
var expect = Code.expect

var Github = require('..')
var Github = require('../lib/github')

/*
* Notice: For travis/CI, tests have been configured with a token provided by
Expand All @@ -23,10 +23,14 @@ var Github = require('..')
describe('nodezoo-github', function () {
it('Fired the get pattern', function (done) {
var seneca = Seneca({ log: 'silent' })
seneca.use(Github, { token: process.env.GITHUB_TOKEN })
seneca.use('entity')
seneca.use(Github, { token: /*GITHUB TOKEN GOES HERE*/})


seneca.ready(function () {
console.log("before")
seneca.act({ role: 'github', cmd: 'get', name: 'nodejs/node.git', giturl: '[email protected]:nodejs/node.git' }, function (err, res) {
console.log(err)
expect(err).to.not.exist()
expect(res.user).to.equal('nodejs')
expect(res.repo).to.equal('node')
Expand All @@ -39,7 +43,7 @@ describe('nodezoo-github', function () {
it('Fired the query pattern', function (done) {
var seneca = Seneca({ log: 'silent' })
seneca.use(Github, { token: process.env.GITHUB_TOKEN })

seneca.use('entity')
seneca.ready(function () {
seneca.act({ role: 'github', cmd: 'query', name: 'nodejs/node.git', user: 'nodejs', repo: 'node' }, function (err, res) {
expect(err).to.not.exist()
Expand All @@ -53,6 +57,7 @@ describe('nodezoo-github', function () {

it('Fired the parse pattern', function (done) {
var seneca = Seneca({ log: 'silent' })
seneca.use('entity')
seneca.use(Github, { token: process.env.GITHUB_TOKEN })

seneca.ready(function () {
Expand Down