Skip to content

Commit e0c1e99

Browse files
committed
maint: Update tests for Jest 30.
1 parent 4208f84 commit e0c1e99

5 files changed

Lines changed: 175 additions & 80 deletions

File tree

src/lib/depends_parse.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ describe("Depedency expression parser", function () {
3030
it("Can not do order comparison to string", function () {
3131
expect(function () {
3232
parser.parse("foo<bar");
33-
}).toThrowError('Expected number or whitespace but "b" found.');
33+
}).toThrow('Expected number or whitespace but "b" found.');
3434
});
3535

3636
it("Equality comparison with string", function () {

src/pat/gallery/gallery.test.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,13 @@ describe("pat-gallery", function () {
3131
const instance = new pattern(el);
3232

3333
const spy_init_trigger = jest.spyOn(instance, "initialize_trigger");
34-
const spy_init_gallery = jest.spyOn(instance, "initialize_gallery");
34+
35+
// Create a spy that prevents the actual PhotoSwipe initialization
36+
const spy_init_gallery = jest.spyOn(instance, "initialize_gallery").mockImplementation((e) => {
37+
e.preventDefault();
38+
// Just return without initializing PhotoSwipe
39+
return;
40+
});
3541

3642
await utils.timeout(1);
3743

@@ -63,7 +69,13 @@ describe("pat-gallery", function () {
6369
const instance = new pattern(el);
6470

6571
const spy_init_trigger = jest.spyOn(instance, "initialize_trigger");
66-
const spy_init_gallery = jest.spyOn(instance, "initialize_gallery");
72+
73+
// Create a spy that prevents the actual PhotoSwipe initialization
74+
const spy_init_gallery = jest.spyOn(instance, "initialize_gallery").mockImplementation((e) => {
75+
e.preventDefault();
76+
// Just return without initializing PhotoSwipe
77+
return;
78+
});
6779

6880
await utils.timeout(1);
6981

0 commit comments

Comments
 (0)