Skip to content

Commit dc24f30

Browse files
committed
remove some code dupe
1 parent f610941 commit dc24f30

File tree

1 file changed

+13
-46
lines changed

1 file changed

+13
-46
lines changed

packages/core/src/test/amazonq/common/tryInstallLsp.test.ts

Lines changed: 13 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,8 @@ const getFakeDownload = function (numberOfFiles: number, fileSize: number) {
6666
}
6767
}
6868

69-
describe('tryInstallLsp performance test', function () {
70-
afterEach(function () {
71-
sinon.restore()
72-
})
73-
/**
74-
* Test setting up LSP when fetched zip is many (250) small (10B) files.
75-
*/
76-
performanceTest(
69+
function performanceTestWrapper(numFiles: number, fileSize: number) {
70+
return performanceTest(
7771
{
7872
testRuns: 10,
7973
linux: {
@@ -99,44 +93,7 @@ describe('tryInstallLsp performance test', function () {
9993
function () {
10094
return {
10195
setup: async () => {
102-
createStubs(250, 10)
103-
},
104-
execute: async () => {
105-
return await LspController.instance.tryInstallLsp(globals.context)
106-
},
107-
verify: async (_setup: any, result: boolean) => {
108-
assert.ok(result)
109-
},
110-
}
111-
}
112-
)
113-
/**
114-
* Test setting up LSP when fetched zip is few (10) large (1000B) files.
115-
*/
116-
performanceTest(
117-
{
118-
testRuns: 10,
119-
linux: {
120-
userCpuUsage: 100,
121-
systemCpuUsage: 50,
122-
heapTotal: 6,
123-
},
124-
darwin: {
125-
userCpuUsage: 100,
126-
systemCpuUsage: 50,
127-
heapTotal: 6,
128-
},
129-
win32: {
130-
userCpuUsage: 100,
131-
systemCpuUsage: 50,
132-
heapTotal: 6,
133-
},
134-
},
135-
'few large files in zip',
136-
function () {
137-
return {
138-
setup: async () => {
139-
createStubs(10, 1000)
96+
createStubs(numFiles, fileSize)
14097
},
14198
execute: async () => {
14299
return await LspController.instance.tryInstallLsp(globals.context)
@@ -147,4 +104,14 @@ describe('tryInstallLsp performance test', function () {
147104
}
148105
}
149106
)
107+
}
108+
109+
describe('tryInstallLsp', function () {
110+
afterEach(function () {
111+
sinon.restore()
112+
})
113+
describe('performance tests', function () {
114+
performanceTestWrapper(250, 10)
115+
performanceTestWrapper(10, 1000)
116+
})
150117
})

0 commit comments

Comments
 (0)