From 0563cbfd14027b52d9988dc3ff11420080bd072a Mon Sep 17 00:00:00 2001 From: joshaber Date: Mon, 25 Jul 2016 11:29:16 -0400 Subject: [PATCH] Do a test --- app/package.json | 2 ++ app/test/local-git-operations-test.ts | 48 +++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 app/test/local-git-operations-test.ts diff --git a/app/package.json b/app/package.json index 3237c088bf..4fddac8d78 100644 --- a/app/package.json +++ b/app/package.json @@ -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" } } diff --git a/app/test/local-git-operations-test.ts b/app/test/local-git-operations-test.ts new file mode 100644 index 0000000000..86d152dc73 --- /dev/null +++ b/app/test/local-git-operations-test.ts @@ -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', () => { + + }) +})