From ca5a54da3002b39cffe9d7117edd36b4eaa966ab Mon Sep 17 00:00:00 2001 From: Gavin Gu Date: Wed, 17 Jul 2024 16:55:41 +0800 Subject: [PATCH] fix: fix UT error --- .../test/officeChat/handlers.test.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/vscode-extension/test/officeChat/handlers.test.ts b/packages/vscode-extension/test/officeChat/handlers.test.ts index f2a205f789..e3ef2254c4 100644 --- a/packages/vscode-extension/test/officeChat/handlers.test.ts +++ b/packages/vscode-extension/test/officeChat/handlers.test.ts @@ -272,17 +272,15 @@ Usage: @office Ask questions about Office Add-ins development.`); }); it("choose to browse and select custom folder", async () => { - const showQuickPickStub = sandbox.stub(vscode.window, "showQuickPick").returns( - Promise.resolve({ - label: "Browse...", - }) as unknown as Promise - ); + const showQuickPickStub = sandbox.stub(vscode.window, "showQuickPick").resolves({ + label: "Browse...", + } as unknown as vscode.QuickPickItem); const fsCopyStub = sandbox.stub(fs, "copy"); const customFolderPath = "customFolderPath"; const customFolder: URI[] = [URI.file(customFolderPath)]; const showOpenDialogStub = sandbox .stub(vscode.window, "showOpenDialog") - .returns(Promise.resolve(customFolder)); + .resolves(customFolder); sandbox.stub(fs, "pathExistsSync").resolves(false); sandbox.stub(localizeUtils, "localize").returns("Default folder"); await handler.chatCreateOfficeProjectCommandHandler( @@ -294,9 +292,9 @@ Usage: @office Ask questions about Office Add-ins development.`); chai.expect(showQuickPickStub.calledOnce).to.equal(true); chai.expect(showOpenDialogStub.calledOnce).to.equal(true); + chai.expect(fsCopyStub.calledOnce).to.equal(true); chai.expect(fsCopyStub.args[0][0]).to.equal("fakeFolder"); chai.expect(path.basename(fsCopyStub.args[0][1])).to.equal("fakeAppId"); - chai.expect(fsCopyStub.calledOnce).to.equal(true); }); it("copy files error", async () => {