2014-02-08 20:51:01 +01:00
|
|
|
should = require 'should'
|
2012-09-15 10:49:39 +02:00
|
|
|
fixtures = require './fixtures'
|
|
|
|
git = require '../src'
|
|
|
|
Commit = require '../src/commit'
|
|
|
|
Tree = require '../src/tree'
|
|
|
|
|
|
|
|
describe "Commit", ->
|
|
|
|
describe "#tree", ->
|
|
|
|
repo = git "#{__dirname}/fixtures/branched"
|
|
|
|
tree = null
|
|
|
|
before (done) ->
|
|
|
|
repo.commits "master", (err, commits) ->
|
|
|
|
tree = commits[0].tree()
|
|
|
|
done err
|
2014-06-20 02:08:29 +02:00
|
|
|
|
2012-09-15 10:49:39 +02:00
|
|
|
it "passes a tree", ->
|
|
|
|
tree.should.be.an.instanceof Tree
|
2014-06-20 02:08:29 +02:00
|
|
|
|
|
|
|
|
2012-09-15 10:49:39 +02:00
|
|
|
describe "#parents", ->
|
|
|
|
repo = fixtures.branched
|
|
|
|
parents = null
|
|
|
|
parent = null
|
|
|
|
before (done) ->
|
|
|
|
repo.commits "something", (err, commits) ->
|
|
|
|
parents = commits[0].parents()
|
|
|
|
parent = commits[1]
|
|
|
|
done err
|
2014-06-20 02:08:29 +02:00
|
|
|
|
2012-09-15 10:49:39 +02:00
|
|
|
it "is an Array of Commits", ->
|
|
|
|
parents.should.be.an.instanceof Array
|
|
|
|
parents[0].should.be.an.instanceof Commit
|
2014-06-20 02:08:29 +02:00
|
|
|
|
2012-09-15 10:49:39 +02:00
|
|
|
it "has the parent commit", ->
|
|
|
|
parents[0].id.should.eql parent.id
|