mirror of
https://github.com/samsonjs/gitter.git
synced 2026-04-10 11:55:50 +00:00
37 lines
1.3 KiB
JavaScript
37 lines
1.3 KiB
JavaScript
var gh = require('../lib')
|
|
, vows = require('vows')
|
|
, assert = require('assert')
|
|
, h = require('./helper')
|
|
|
|
, User = 'samsonjs'
|
|
, Repo = 'gitter'
|
|
, Proj = User + '/' + Repo
|
|
, Branch = 'master'
|
|
|
|
vows.describe('Branch').addBatch({
|
|
'after fetching a branch': {
|
|
topic: function() { gh.branch(Proj, Branch, this.callback) },
|
|
'the data object can be accessed with the data() method': function(err, branch) {
|
|
assert.ifError(err)
|
|
assert.ok(branch)
|
|
assert.instanceOf(branch.data(), Object)
|
|
},
|
|
'attributes can be accessed with the data() method': function(err, branch) {
|
|
assert.ifError(err)
|
|
assert.instanceOf(branch.data('author'), Object)
|
|
},
|
|
'expected fields are present': function(err, branch) {
|
|
assert.ifError(err)
|
|
assert.ok(h.looksLikeABranch(branch.data()))
|
|
},
|
|
},
|
|
'after fetching commits': {
|
|
topic: function() { gh.commits(Proj, Branch, this.callback) },
|
|
'list of commits is available': function(err, commits) {
|
|
assert.ifError(err)
|
|
assert.ok(commits)
|
|
assert.instanceOf(commits, Array)
|
|
assert.ok(commits.every(function(c) { return h.looksLikeACommit(c) }))
|
|
}
|
|
}
|
|
}).export(module)
|