Skip to content

Commit bcac47e

Browse files
CopilotLipata
andcommitted
test: adjust React and WebComponents tests for new workspace detection logic
Co-authored-by: Lipata <[email protected]>
1 parent 74cb2b9 commit bcac47e

File tree

2 files changed

+1716
-1425
lines changed

2 files changed

+1716
-1425
lines changed

spec/unit/update-spec.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,8 @@ title = 'igniteui-angular example';
521521
}
522522
};
523523
(fsSpy.fileExists as jasmine.Spy).and.returnValue(true);
524+
// Mock directoryExists to return false for projects directory to avoid extra glob calls
525+
(fsSpy.directoryExists as jasmine.Spy).and.returnValue(false);
524526
(fsSpy.glob as jasmine.Spy).and.returnValues // per workspace
525527
([ "package.json" ], // root package.json
526528
[], // html files
@@ -708,6 +710,8 @@ export default function Home() {
708710
return fileEntry.content;
709711
});
710712
(fsSpy.fileExists as jasmine.Spy).and.returnValue(true);
713+
// Mock directoryExists to return false for projects directory to avoid extra glob calls
714+
(fsSpy.directoryExists as jasmine.Spy).and.returnValue(false);
711715
spyOn(PackageManager, "ensureRegistryUser").and.returnValue(true);
712716
expect(await updateWorkspace("")).toEqual(true);
713717
for (const fileEntry of mockFileArray) {
@@ -926,6 +930,8 @@ export default defineConfig({
926930
});
927931
(fsSpy.fileExists as jasmine.Spy).and.returnValue(true);
928932
spyOn(PackageManager, "ensureRegistryUser").and.returnValue(true);
933+
// Mock directoryExists to return false for projects directory to avoid extra glob calls
934+
(fsSpy.directoryExists as jasmine.Spy).and.returnValue(false);
929935
expect(await updateWorkspace("")).toEqual(true);
930936
for (const fileEntry of mockFileArray) {
931937
expect((fsSpy.writeFile as jasmine.Spy)).toHaveBeenCalledWith(fileEntry.path, fileEntry.expected);
@@ -1098,6 +1104,8 @@ export const GridComponent = () => {
10981104
}
10991105
};
11001106
(fsSpy.fileExists as jasmine.Spy).and.returnValue(true);
1107+
// Mock directoryExists to return false for projects directory to avoid extra glob calls
1108+
(fsSpy.directoryExists as jasmine.Spy).and.returnValue(false);
11011109
(fsSpy.glob as jasmine.Spy).and.returnValues // per workspace
11021110
([ "package.json" ], // root package.json
11031111
[], //index.html
@@ -1272,6 +1280,8 @@ export default class App extends LitElement {
12721280
return fileEntry.content;
12731281
});
12741282
(fsSpy.fileExists as jasmine.Spy).and.returnValue(true);
1283+
// Mock directoryExists to return false for projects directory to avoid extra glob calls
1284+
(fsSpy.directoryExists as jasmine.Spy).and.returnValue(false);
12751285
spyOn(PackageManager, "ensureRegistryUser").and.returnValue(true);
12761286
expect(await updateWorkspace("")).toEqual(true);
12771287
for (const fileEntry of mockFileArray) {
@@ -1477,6 +1487,8 @@ export default defineConfig(({ mode }) => {
14771487
return fileEntry ? fileEntry.content : "";
14781488
});
14791489
(fsSpy.fileExists as jasmine.Spy).and.returnValue(true);
1490+
// Mock directoryExists to return false for projects directory to avoid extra glob calls
1491+
(fsSpy.directoryExists as jasmine.Spy).and.returnValue(false);
14801492
spyOn(PackageManager, "ensureRegistryUser").and.returnValue(true);
14811493
expect(await updateWorkspace("")).toEqual(true);
14821494
for (const fileEntry of mockFileArray) {

0 commit comments

Comments
 (0)