Skip to content

Commit

Permalink
test: fix ut fail
Browse files Browse the repository at this point in the history
  • Loading branch information
HuihuiWu-Microsoft committed Jul 8, 2024
1 parent 0396ba1 commit fb49720
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions packages/fx-core/tests/component/generator/spfxGenerator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -469,8 +469,10 @@ describe("SPFxGenerator", function () {
sinon.stub(fs, "readdir").callsFake((directory: any) => {
if (directory === path.join("c:\\test", "teams")) {
return ["1_color.png", "1_outline.png"] as any;
} else {
} else if (directory === path.join("c:\\test", "src", "webparts")) {
return ["helloworld", "second"] as any;
} else {
return ["HelloWorldWebPart.manifest.json"] as any;
}
});
sinon.stub(fs, "statSync").returns({
Expand Down Expand Up @@ -502,7 +504,15 @@ describe("SPFxGenerator", function () {
};

sinon.stub(fs, "pathExists").resolves(true);
sinon.stub(fs, "readdir").resolves(["helloworld", "second"] as any);
sinon.stub(fs, "readdir").callsFake((directory: any) => {
if (directory === path.join("c:\\test", "teams")) {
return ["1_color.png", "1_outline.png"] as any;
} else if (directory === path.join("c:\\test", "src", "webparts")) {
return ["helloworld", "second"] as any;
} else {
return ["HelloWorldWebPart.manifest.json"] as any;
}
});
sinon.stub(fs, "statSync").returns({
isDirectory: () => {
return true;
Expand Down Expand Up @@ -532,8 +542,10 @@ describe("SPFxGenerator", function () {
sinon.stub(fs, "readdir").callsFake((directory: any) => {
if (directory === path.join("c:\\test", "teams")) {
return ["1_color.png", "1_outline.png"] as any;
} else {
} else if (directory === path.join("c:\\test", "src", "webparts")) {
return ["helloworld", "second"] as any;
} else {
return ["HelloWorldWebPart.manifest.json"] as any;
}
});
sinon.stub(fs, "statSync").returns({
Expand Down

0 comments on commit fb49720

Please sign in to comment.