Do a test

This commit is contained in:
joshaber 2016-07-25 11:29:16 -04:00
parent a12a9e77b9
commit 0563cbfd14
2 changed files with 50 additions and 0 deletions

View file

@ -23,10 +23,12 @@
"react-dom": "^15.2.1"
},
"devDependencies": {
"fs-extra": "^0.30.0",
"react-addons-perf": "^15.2.1",
"react-addons-test-utils": "^15.2.1",
"react-transform-hmr": "^1.0.4",
"style-loader": "^0.13.1",
"temp": "^0.8.3",
"webpack-hot-middleware": "^2.10.0"
}
}

View file

@ -0,0 +1,48 @@
import * as chai from 'chai'
const expect = chai.expect
import * as path from 'path'
const fs = require('fs-extra')
const temp = require('temp').track()
import Repository from '../src/models/repository'
import { LocalGitOperations } from '../src/lib/local-git-operations'
describe('LocalGitOperations', () => {
let repository: Repository | null = null
beforeEach(() => {
const testRepoName = 'test-repo'
const testRepoFixturePath = path.join(__dirname, 'fixtures', testRepoName)
const testRepoPath = temp.mkdirSync('desktop-git-test-')
fs.copySync(testRepoFixturePath, testRepoPath)
fs.renameSync(path.join(testRepoPath, '_git'), path.join(testRepoPath, '.git'))
repository = new Repository(testRepoPath, null, null)
})
describe('status', () => {
it('parses changed files', async () => {
fs.writeFileSync(path.join(repository!.path, 'README.md'), 'Hi world\n')
const status = await LocalGitOperations.getStatus(repository!)
expect(status.workingDirectory.files.length).to.equal(1)
})
})
describe('committing', () => {
})
describe('history', () => {
describe('changed files', () => {
})
})
describe('config', () => {
})
})