Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit 1e36f7c

Browse files
committed
Fix tests
1 parent 172d76b commit 1e36f7c

File tree

2 files changed

+14
-19
lines changed

2 files changed

+14
-19
lines changed

spec/buffer-view-spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const BufferView = require('../lib/buffer-view')
55

66
describe('BufferView', () => {
77
it('shows the avatar for editors that are remote', async () => {
8-
const bufferView = new BufferView()
8+
const bufferView = new BufferView({incrementCounter: () => {}})
99

1010
const localEditor1 = await atom.workspace.open(path.join(temp.path(), 'a'))
1111
const localEditor2 = await atom.workspace.open(path.join(temp.path(), 'b'))

spec/fuzzy-finder-spec.js

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,17 @@ function getOrScheduleUpdatePromise () {
3030
}
3131

3232
describe('FuzzyFinder', () => {
33+
let disposable, reporterStub
3334
let rootDir1, rootDir2
3435
let fuzzyFinder, projectView, bufferView, gitStatusView, workspaceElement, fixturesPath
3536

3637
beforeEach(async () => {
38+
reporterStub = {
39+
addTiming: sinon.spy(),
40+
incrementCounter: () => {}
41+
}
42+
disposable = fuzzyFinderPackage.consumeMetricsReporter(reporterStub)
43+
3744
const ancestorDir = fs.realpathSync(temp.mkdirSync())
3845
rootDir1 = path.join(ancestorDir, 'root-dir1')
3946
rootDir2 = path.join(ancestorDir, 'root-dir2')
@@ -66,6 +73,12 @@ describe('FuzzyFinder', () => {
6673
jasmine.useRealClock()
6774
})
6875

76+
afterEach(() => {
77+
if (disposable) {
78+
disposable.dispose()
79+
}
80+
})
81+
6982
async function waitForPathsToDisplay (fuzzyFinderView) {
7083
return conditionPromise(() => fuzzyFinderView.element.querySelectorAll('li').length > 0)
7184
}
@@ -1658,21 +1671,7 @@ describe('FuzzyFinder', () => {
16581671
})
16591672

16601673
describe('logging of metrics events', () => {
1661-
let disposable
1662-
1663-
afterEach(() => {
1664-
if (disposable) {
1665-
disposable.dispose()
1666-
}
1667-
})
1668-
16691674
it('logs the crawling time', async () => {
1670-
const reporterStub = {
1671-
addTiming: sinon.spy()
1672-
}
1673-
1674-
disposable = fuzzyFinderPackage.consumeMetricsReporter(reporterStub)
1675-
16761675
// After setting the reporter it may receive some old events from previous tests
16771676
// that we want to discard.
16781677
reporterStub.addTiming.reset()
@@ -1688,10 +1687,6 @@ describe('FuzzyFinder', () => {
16881687
})
16891688

16901689
it('queues the events until a reporter is set', async () => {
1691-
const reporterStub = {
1692-
addTiming: sinon.spy()
1693-
}
1694-
16951690
// After setting the reporter it may receive some old events from previous tests
16961691
// that we want to discard.
16971692
reporterStub.addTiming.reset()

0 commit comments

Comments
 (0)