Fix repository tests that fail when run in fork of atom/atom

Prior to this change, these tests assumed that the local repository is a
clone of atom/atom, and the tests (unintentionally) failed if the local
repository was a fork of atom/atom:

https://circleci.com/gh/marcomorain/atom-1/29

Instead of depending on the local clone of the atom repository for these
tests, this commit updates the tests to use one of the fixture
repositories. 😅
This commit is contained in:
Jason Rudolph
2018-07-27 09:40:38 -04:00
parent b9966ac3df
commit c74971e40c
2 changed files with 18 additions and 5 deletions

View File

@@ -4,3 +4,6 @@
bare = false
logallrefupdates = true
ignorecase = true
[remote "origin"]
url = https://github.com/example-user/example-repo.git
fetch = +refs/heads/*:refs/remotes/origin/*

View File

@@ -1000,10 +1000,13 @@ describe('Project', () => {
const observed = []
const disposable = atom.project.onDidAddRepository((repo) => observed.push(repo))
const repositoryPath = path.join(__dirname, '..')
atom.project.addPath(repositoryPath)
const projectRootPath = temp.mkdirSync()
const fixtureRepoPath = fs.absolute(path.join(__dirname, 'fixtures', 'git', 'master.git'))
fs.copySync(fixtureRepoPath, path.join(projectRootPath, '.git'))
atom.project.addPath(projectRootPath)
expect(observed.length).toBe(1)
expect(observed[0].getOriginURL()).toContain('atom/atom')
expect(observed[0].getOriginURL()).toEqual('https://github.com/example-user/example-repo.git')
disposable.dispose()
})
@@ -1012,9 +1015,16 @@ describe('Project', () => {
const observed = []
const disposable = atom.project.onDidAddRepository((repo) => observed.push(repo))
atom.project.addPath(__dirname)
const projectRootPath = temp.mkdirSync()
const fixtureRepoPath = fs.absolute(path.join(__dirname, 'fixtures', 'git', 'master.git'))
fs.copySync(fixtureRepoPath, path.join(projectRootPath, '.git'))
const projectSubDirPath = path.join(projectRootPath, 'sub-dir')
fs.mkdirSync(projectSubDirPath)
atom.project.addPath(projectSubDirPath)
expect(observed.length).toBe(1)
expect(observed[0].getOriginURL()).toContain('atom/atom')
expect(observed[0].getOriginURL()).toEqual('https://github.com/example-user/example-repo.git')
disposable.dispose()
})