1
0
mirror of https://github.com/danog/gift.git synced 2024-11-30 04:19:37 +01:00
gift/test/status.test.coffee

62 lines
1.8 KiB
CoffeeScript
Raw Permalink Normal View History

2012-02-15 15:51:45 +01:00
should = require 'should'
fixtures = require './fixtures'
git = require '../src'
Status = require '../src/status'
GIT_STATUS = """
2013-03-13 22:24:57 +01:00
M cheese.txt
D crackers.txt
M file.txt
?? pickles.txt
2012-03-23 15:58:50 +01:00
"""
2013-03-13 22:24:57 +01:00
GIT_STATUS_CLEAN = ""
2012-03-23 20:11:37 +01:00
GIT_STATUS_NOT_CLEAN = """
2013-03-13 22:24:57 +01:00
A lib/index.js
M npm-shrinkwrap.json
M package.json
2012-03-23 20:11:37 +01:00
"""
2012-02-15 15:51:45 +01:00
describe "Status", ->
describe "()", ->
2012-03-23 15:58:50 +01:00
describe "when there are no changes", ->
repo = fixtures.status
status = new Status.Status repo
status.parse GIT_STATUS_CLEAN
2012-03-23 15:58:50 +01:00
it "is clean", ->
status.clean.should.be.true
2012-03-23 20:11:37 +01:00
describe "when there are changes", ->
repo = fixtures.status
status = new Status.Status repo
status.parse GIT_STATUS_NOT_CLEAN
it "is not clean", ->
status.clean.should.be.false
2012-02-15 15:51:45 +01:00
describe "when there are changes", ->
repo = fixtures.status
status = new Status.Status repo
status.parse GIT_STATUS
2012-02-15 15:51:45 +01:00
it "has a modified staged file", ->
status.files["file.txt"].staged.should.be.true
status.files["file.txt"].type.should.eql "M"
status.files["file.txt"].tracked.should.be.true
2012-02-15 15:51:45 +01:00
it "has a modified unstaged file", ->
status.files["cheese.txt"].staged.should.be.false
status.files["cheese.txt"].type.should.eql "M"
status.files["cheese.txt"].tracked.should.be.true
2012-02-15 15:51:45 +01:00
it "has a deleted file", ->
status.files["crackers.txt"].staged.should.be.true
status.files["crackers.txt"].type.should.eql "D"
status.files["crackers.txt"].tracked.should.be.true
2012-02-15 15:51:45 +01:00
it "has an untracked file", ->
status.files["pickles.txt"].tracked.should.be.false
should.not.exist status.files["pickles.txt"].type
2012-02-15 15:51:45 +01:00
it "is not clean", ->
status.clean.should.be.false