Repository: atom/atom
File: spec/project-spec.js (JavaScript)

Code before:
      expect(atom.project.getPaths()[0]).toBeUndefined()
      let editor = null

      waitsForPromise(() => atom.workspace.open().then(o => { editor = o }))

      waitsForPromise(() => editor.saveAs(tempFile))

      runs(() => expect(atom.project.getPaths()[0]).toBe(path.dirname(tempFile)))
    })
  })

  describe('atomProject', () => {
    let newSettings, projectPath1, projectPath2
    beforeEach(() => {
      atom.project.replace(null)
      projectPath1 = temp.mkdirSync('project-path1')
      projectPath2 = temp.mkdirSync('project-path2')
      newSettings = {
        paths: [projectPath1, projectPath2],
        originPath: "originPath",
        config: {
          "baz": "buzz"
        }
      }
    })
    it('sets an atomproject', () => {
      expect(atom.config.get('baz')).toBeUndefined()
      atom.project.replace(newSettings)
      expect(atom.project.getPaths()).toEqual([projectPath1, projectPath2])
      expect(atom.config.get('baz')).toBe('buzz')
    })

    it('clears an atom project through replace with no params', () => {
      expect(atom.config.get('baz')).toBeUndefined()
      atom.project.replace(newSettings)
      expect(atom.config.get('baz')).toBe("buzz")
      expect(atom.project.getPaths()).toEqual([projectPath1, projectPath2])
      atom.project.replace()
      expect(atom.config.get('baz')).toBeUndefined()
      expect(atom.project.getPaths()).toEqual([])
    })

    it('responds to change of atom project', () => {
      let wasCalled = false
      const callback = () => {
        wasCalled = true
      }
      atom.project.onDidReplace(callback)
      atom.project.replace(newSettings)
      expect(wasCalled).toBe(true)
      wasCalled = false

Review comment (suggestion):
can you do a pass to make sure you don't use "atomproject" or "atom project" like this? they should probably all be either just plain "project" or "project specification" (or whatever term we pick) depending on the conext.

Code after:
      expect(atom.project.getPaths()[0]).toBeUndefined()
      let editor = null

      waitsForPromise(() => atom.workspace.open().then(o => { editor = o }))

      waitsForPromise(() => editor.saveAs(tempFile))

      runs(() => expect(atom.project.getPaths()[0]).toBe(path.dirname(tempFile)))
    })
  })

  describe('.replace', () => {
    let projectSpecification, projectPath1, projectPath2
    beforeEach(() => {
      atom.project.replace(null)
      projectPath1 = temp.mkdirSync('project-path1')
      projectPath2 = temp.mkdirSync('project-path2')
      projectSpecification = {
        paths: [projectPath1, projectPath2],
        originPath: 'originPath',
        config: {
          'baz': 'buzz'
        }
      }
    })
    it('sets a project specification', () => {
      expect(atom.config.get('baz')).toBeUndefined()
      atom.project.replace(projectSpecification)
      expect(atom.project.getPaths()).toEqual([projectPath1, projectPath2])
      expect(atom.config.get('baz')).toBe('buzz')
    })

    it('clears a project through replace with no params', () => {
      expect(atom.config.get('baz')).toBeUndefined()
      atom.project.replace(projectSpecification)
      expect(atom.config.get('baz')).toBe('buzz')
      expect(atom.project.getPaths()).toEqual([projectPath1, projectPath2])
      atom.project.replace()
      expect(atom.config.get('baz')).toBeUndefined()
      expect(atom.project.getPaths()).toEqual([])
    })

    it('responds to change of project specification', () => {
      let wasCalled = false
      const callback = () => {
        wasCalled = true
      }
      atom.project.onDidReplace(callback)
      atom.project.replace(projectSpecification)
      expect(wasCalled).toBe(true)
      wasCalled = false