@geospatial-sdk/legend 0.0.5-dev.50 → 0.0.5-dev.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,9 @@ import { WmtsEndpoint } from "@camptocamp/ogc-client";
4
4
 
5
5
  // Mock dependencies
6
6
  vi.mock("@camptocamp/ogc-client", () => ({
7
- WmtsEndpoint: vi.fn(),
7
+ WmtsEndpoint: class WmtsMock {
8
+ isReady() {}
9
+ },
8
10
  }));
9
11
 
10
12
  describe("createLegendFromLayer", () => {
@@ -60,12 +62,12 @@ describe("createLegendFromLayer", () => {
60
62
  getLayerByName: () => ({
61
63
  styles: [{ legendUrl: mockLegendUrl }],
62
64
  }),
63
- };
65
+ } as unknown as WmtsEndpoint;
64
66
 
65
67
  // Mock WmtsEndpoint
66
- (WmtsEndpoint as any).mockImplementation(() => ({
67
- isReady: () => Promise.resolve(mockIsReady),
68
- }));
68
+ vi.spyOn(WmtsEndpoint.prototype, "isReady").mockImplementation(function () {
69
+ return Promise.resolve(mockIsReady);
70
+ });
69
71
 
70
72
  const result = await createLegendFromLayer(baseWmtsLayer);
71
73
 
@@ -79,12 +81,12 @@ describe("createLegendFromLayer", () => {
79
81
  getLayerByName: () => ({
80
82
  styles: [],
81
83
  }),
82
- };
84
+ } as unknown as WmtsEndpoint;
83
85
 
84
86
  // Mock WmtsEndpoint
85
- (WmtsEndpoint as any).mockImplementation(() => ({
86
- isReady: () => Promise.resolve(mockIsReady),
87
- }));
87
+ vi.spyOn(WmtsEndpoint.prototype, "isReady").mockImplementation(function () {
88
+ return Promise.resolve(mockIsReady);
89
+ });
88
90
 
89
91
  const result = await createLegendFromLayer(baseWmtsLayer);
90
92
 
@@ -138,7 +140,7 @@ describe("createLegendFromLayer", () => {
138
140
  it("adds accessibility attributes", async () => {
139
141
  const result = await createLegendFromLayer(baseWmsLayer);
140
142
 
141
- expect(result.getAttribute("role")).toBe("region");
142
- expect(result.getAttribute("aria-label")).toBe("Map Layer Legend");
143
+ expect(result?.getAttribute("role")).toBe("region");
144
+ expect(result?.getAttribute("aria-label")).toBe("Map Layer Legend");
143
145
  });
144
146
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geospatial-sdk/legend",
3
- "version": "0.0.5-dev.50+c8ee5e3",
3
+ "version": "0.0.5-dev.52+73ea489",
4
4
  "description": "Get legend graphic from the map-context",
5
5
  "keywords": [
6
6
  "legend"
@@ -30,10 +30,10 @@
30
30
  "build": "tsc"
31
31
  },
32
32
  "devDependencies": {
33
- "@geospatial-sdk/core": "^0.0.5-dev.50+c8ee5e3"
33
+ "@geospatial-sdk/core": "^0.0.5-dev.52+73ea489"
34
34
  },
35
35
  "bugs": {
36
36
  "url": "https://github.com/camptocamp/geospatial-sdk/issues"
37
37
  },
38
- "gitHead": "c8ee5e32059a06e056a5723987baf5e2574bf784"
38
+ "gitHead": "73ea4890e493aae5379e23af6b7679bab253db92"
39
39
  }