@flighthq/geolocation 0.5.1-next.1295.2b6bfa3 → 0.5.1-next.1345.0995dc5
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.
- package/README.md +2 -2
- package/dist/contract.d.ts +1 -1
- package/dist/contract.d.ts.map +1 -1
- package/dist/contract.js +1 -1
- package/dist/contract.js.map +1 -1
- package/dist/geolocation.d.ts +0 -2
- package/dist/geolocation.d.ts.map +1 -1
- package/dist/geolocation.js +0 -125
- package/dist/geolocation.js.map +1 -1
- package/package.json +3 -3
- package/src/geolocation.test.ts +0 -77
package/README.md
CHANGED
|
@@ -13,5 +13,5 @@ Import the supported application-facing API from `@flighthq/geolocation`. The `@
|
|
|
13
13
|
This package is part of the locked-version Flight SDK graph. Applications may instead install and import `@flighthq/sdk` when package-level tree shaking is sufficient.
|
|
14
14
|
|
|
15
15
|
- [Flight project](https://github.com/flighthq/flight)
|
|
16
|
-
- [Source for @flighthq/geolocation@0.5.1-next.
|
|
17
|
-
- [License](https://github.com/flighthq/flight/blob/
|
|
16
|
+
- [Source for @flighthq/geolocation@0.5.1-next.1345.0995dc5](https://github.com/flighthq/flight/tree/0995dc5f840e6b57c3e85ecd2123aa798cf60b29/packages/geolocation)
|
|
17
|
+
- [License](https://github.com/flighthq/flight/blob/0995dc5f840e6b57c3e85ecd2123aa798cf60b29/LICENSE.md)
|
package/dist/contract.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export * from './geolocation';
|
|
2
2
|
export * from './geolocationAccess';
|
|
3
|
-
export { initializeGeolocationPosition
|
|
3
|
+
export { initializeGeolocationPosition } from './geolocation';
|
|
4
4
|
//# sourceMappingURL=contract.d.ts.map
|
package/dist/contract.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,6BAA6B,EAAE
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,6BAA6B,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/contract.js
CHANGED
package/dist/contract.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,6BAA6B,EAAE
|
|
1
|
+
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,6BAA6B,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/geolocation.d.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import type { HostGeolocationProvider, GeolocationErrorReason, GeolocationPosition as FlightGeolocationPosition, GeolocationPositionResult, GeolocationRequestOptions, EntityConstruction } from '@flighthq/types/contract';
|
|
2
2
|
export declare function clearGeolocationWatch(hostGeolocation: Readonly<HostGeolocationProvider>, id: number): void;
|
|
3
3
|
export declare function createGeolocationPosition(): FlightGeolocationPosition;
|
|
4
|
-
export declare function createWebGeolocationBackend(): HostGeolocationProvider;
|
|
5
4
|
export declare function getCurrentGeolocationPosition(hostGeolocation: Readonly<HostGeolocationProvider>, options?: Readonly<GeolocationRequestOptions>): Promise<FlightGeolocationPosition | null>;
|
|
6
5
|
export declare function getCurrentGeolocationPositionResult(hostGeolocation: Readonly<HostGeolocationProvider>, options?: Readonly<GeolocationRequestOptions>): Promise<GeolocationPositionResult>;
|
|
7
6
|
export declare function initializeGeolocationPosition(out: EntityConstruction<FlightGeolocationPosition>): void;
|
|
8
|
-
export declare function initializeWebGeolocationBackend(out: EntityConstruction<HostGeolocationProvider>): void;
|
|
9
7
|
export declare function isGeolocationAvailable(hostGeolocation: Readonly<HostGeolocationProvider>): boolean;
|
|
10
8
|
export declare function watchGeolocationPosition(hostGeolocation: Readonly<HostGeolocationProvider>, handler: (position: Readonly<FlightGeolocationPosition>) => void, options?: Readonly<GeolocationRequestOptions>, onError?: (reason: GeolocationErrorReason) => void): number;
|
|
11
9
|
//# sourceMappingURL=geolocation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geolocation.d.ts","sourceRoot":"","sources":["../src/geolocation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"geolocation.d.ts","sourceRoot":"","sources":["../src/geolocation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,uBAAuB,EACvB,sBAAsB,EACtB,mBAAmB,IAAI,yBAAyB,EAChD,yBAAyB,EACzB,yBAAyB,EACzB,kBAAkB,EACnB,MAAM,0BAA0B,CAAC;AAElC,wBAAgB,qBAAqB,CAAC,eAAe,EAAE,QAAQ,CAAC,uBAAuB,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAE1G;AAED,wBAAgB,yBAAyB,IAAI,yBAAyB,CAIrE;AAED,wBAAgB,6BAA6B,CAC3C,eAAe,EAAE,QAAQ,CAAC,uBAAuB,CAAC,EAClD,OAAO,CAAC,EAAE,QAAQ,CAAC,yBAAyB,CAAC,GAC5C,OAAO,CAAC,yBAAyB,GAAG,IAAI,CAAC,CAE3C;AAED,wBAAgB,mCAAmC,CACjD,eAAe,EAAE,QAAQ,CAAC,uBAAuB,CAAC,EAClD,OAAO,CAAC,EAAE,QAAQ,CAAC,yBAAyB,CAAC,GAC5C,OAAO,CAAC,yBAAyB,CAAC,CAEpC;AAED,wBAAgB,6BAA6B,CAAC,GAAG,EAAE,kBAAkB,CAAC,yBAAyB,CAAC,GAAG,IAAI,CAUtG;AAED,wBAAgB,sBAAsB,CAAC,eAAe,EAAE,QAAQ,CAAC,uBAAuB,CAAC,GAAG,OAAO,CAElG;AAED,wBAAgB,wBAAwB,CACtC,eAAe,EAAE,QAAQ,CAAC,uBAAuB,CAAC,EAClD,OAAO,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,yBAAyB,CAAC,KAAK,IAAI,EAChE,OAAO,CAAC,EAAE,QAAQ,CAAC,yBAAyB,CAAC,EAC7C,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,sBAAsB,KAAK,IAAI,GACjD,MAAM,CAER"}
|
package/dist/geolocation.js
CHANGED
|
@@ -7,11 +7,6 @@ export function createGeolocationPosition() {
|
|
|
7
7
|
initializeGeolocationPosition(out);
|
|
8
8
|
return finishEntity(out);
|
|
9
9
|
}
|
|
10
|
-
export function createWebGeolocationBackend() {
|
|
11
|
-
const out = allocateEntity();
|
|
12
|
-
initializeWebGeolocationBackend(out);
|
|
13
|
-
return finishEntity(out);
|
|
14
|
-
}
|
|
15
10
|
export function getCurrentGeolocationPosition(hostGeolocation, options) {
|
|
16
11
|
return hostGeolocation.getCurrentPosition(options ?? _emptyOptions);
|
|
17
12
|
}
|
|
@@ -29,80 +24,6 @@ export function initializeGeolocationPosition(out) {
|
|
|
29
24
|
out.speed = 0;
|
|
30
25
|
out.timestamp = 0;
|
|
31
26
|
}
|
|
32
|
-
export function initializeWebGeolocationBackend(out) {
|
|
33
|
-
out.clearWatch = (id) => {
|
|
34
|
-
const geo = getWebGeolocation();
|
|
35
|
-
if (geo === null || typeof geo.clearWatch !== 'function')
|
|
36
|
-
return;
|
|
37
|
-
try {
|
|
38
|
-
geo.clearWatch(id);
|
|
39
|
-
}
|
|
40
|
-
catch {
|
|
41
|
-
// Expected failure: the watch may already be gone or the host may deny access.
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
out.getCurrentPosition = (options) => {
|
|
45
|
-
return new Promise((resolve) => {
|
|
46
|
-
const geo = getWebGeolocation();
|
|
47
|
-
if (geo === null || typeof geo.getCurrentPosition !== 'function') {
|
|
48
|
-
resolve(null);
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
try {
|
|
52
|
-
geo.getCurrentPosition((position) => resolve(mapWebPosition(position)), () => resolve(null), toPositionOptions(options));
|
|
53
|
-
}
|
|
54
|
-
catch {
|
|
55
|
-
resolve(null);
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
};
|
|
59
|
-
out.getCurrentPositionResult = (options) => {
|
|
60
|
-
return new Promise((resolve) => {
|
|
61
|
-
const geo = getWebGeolocation();
|
|
62
|
-
if (geo === null || typeof geo.getCurrentPosition !== 'function') {
|
|
63
|
-
resolve({ position: null, reason: 'unavailable' });
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
try {
|
|
67
|
-
geo.getCurrentPosition((position) => resolve({ position: mapWebPosition(position), reason: null }), (error) => resolve({ position: null, reason: mapWebPositionError(error) }), toPositionOptions(options));
|
|
68
|
-
}
|
|
69
|
-
catch {
|
|
70
|
-
resolve({ position: null, reason: 'unavailable' });
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
};
|
|
74
|
-
out.isAvailable = () => {
|
|
75
|
-
if (typeof window !== 'undefined' && window.isSecureContext === false)
|
|
76
|
-
return false;
|
|
77
|
-
return getWebGeolocation() !== null;
|
|
78
|
-
};
|
|
79
|
-
out.promptForAccess = () => {
|
|
80
|
-
return new Promise((resolve) => {
|
|
81
|
-
const geo = getWebGeolocation();
|
|
82
|
-
if (geo === null || typeof geo.getCurrentPosition !== 'function') {
|
|
83
|
-
resolve({ reason: 'runtime-unavailable' });
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
try {
|
|
87
|
-
geo.getCurrentPosition(() => resolve({ reason: 'granted' }), (error) => resolve({ reason: mapWebAccessError(error) }));
|
|
88
|
-
}
|
|
89
|
-
catch {
|
|
90
|
-
resolve({ reason: 'operation-failed' });
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
};
|
|
94
|
-
out.watchPosition = (listener, options, onError) => {
|
|
95
|
-
const geo = getWebGeolocation();
|
|
96
|
-
if (geo === null || typeof geo.watchPosition !== 'function')
|
|
97
|
-
return -1;
|
|
98
|
-
try {
|
|
99
|
-
return geo.watchPosition((position) => listener(mapWebPosition(position)), onError !== undefined ? (error) => onError(mapWebPositionError(error)) : () => { }, toPositionOptions(options));
|
|
100
|
-
}
|
|
101
|
-
catch {
|
|
102
|
-
return -1;
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
27
|
export function isGeolocationAvailable(hostGeolocation) {
|
|
107
28
|
return hostGeolocation.isAvailable();
|
|
108
29
|
}
|
|
@@ -110,50 +31,4 @@ export function watchGeolocationPosition(hostGeolocation, handler, options, onEr
|
|
|
110
31
|
return hostGeolocation.watchPosition(handler, options ?? _emptyOptions, onError);
|
|
111
32
|
}
|
|
112
33
|
const _emptyOptions = {};
|
|
113
|
-
function getWebGeolocation() {
|
|
114
|
-
if (typeof navigator === 'undefined')
|
|
115
|
-
return null;
|
|
116
|
-
return navigator.geolocation ?? null;
|
|
117
|
-
}
|
|
118
|
-
function mapWebPosition(position) {
|
|
119
|
-
const coords = position.coords;
|
|
120
|
-
const out = allocateEntity();
|
|
121
|
-
out.accuracy = coords.accuracy;
|
|
122
|
-
out.altitude = coords.altitude ?? 0;
|
|
123
|
-
out.altitudeAccuracy = coords.altitudeAccuracy ?? 0;
|
|
124
|
-
out.floorLevel = coords.floorLevel ?? 0;
|
|
125
|
-
out.heading = coords.heading ?? 0;
|
|
126
|
-
out.latitude = coords.latitude;
|
|
127
|
-
out.longitude = coords.longitude;
|
|
128
|
-
out.speed = coords.speed ?? 0;
|
|
129
|
-
out.timestamp = position.timestamp;
|
|
130
|
-
return finishEntity(out);
|
|
131
|
-
}
|
|
132
|
-
function mapWebAccessError(error) {
|
|
133
|
-
switch (error.code) {
|
|
134
|
-
case 1:
|
|
135
|
-
return 'denied';
|
|
136
|
-
case 3:
|
|
137
|
-
return 'timeout';
|
|
138
|
-
default:
|
|
139
|
-
return 'operation-failed';
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
function mapWebPositionError(error) {
|
|
143
|
-
switch (error.code) {
|
|
144
|
-
case 1:
|
|
145
|
-
return 'denied';
|
|
146
|
-
case 3:
|
|
147
|
-
return 'timeout';
|
|
148
|
-
default:
|
|
149
|
-
return 'unavailable';
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
function toPositionOptions(options) {
|
|
153
|
-
return {
|
|
154
|
-
enableHighAccuracy: options.enableHighAccuracy ?? false,
|
|
155
|
-
maximumAge: options.maximumAgeMs,
|
|
156
|
-
timeout: options.timeoutMs,
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
34
|
//# sourceMappingURL=geolocation.js.map
|
package/dist/geolocation.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geolocation.js","sourceRoot":"","sources":["../src/geolocation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"geolocation.js","sourceRoot":"","sources":["../src/geolocation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAUzE,MAAM,UAAU,qBAAqB,CAAC,eAAkD,EAAE,EAAU;IAClG,eAAe,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,yBAAyB;IACvC,MAAM,GAAG,GAAG,cAAc,EAA6B,CAAC;IACxD,6BAA6B,CAAC,GAAG,CAAC,CAAC;IACnC,OAAO,YAAY,CAAC,GAAG,CAAC,CAAC;AAC3B,CAAC;AAED,MAAM,UAAU,6BAA6B,CAC3C,eAAkD,EAClD,OAA6C;IAE7C,OAAO,eAAe,CAAC,kBAAkB,CAAC,OAAO,IAAI,aAAa,CAAC,CAAC;AACtE,CAAC;AAED,MAAM,UAAU,mCAAmC,CACjD,eAAkD,EAClD,OAA6C;IAE7C,OAAO,eAAe,CAAC,wBAAwB,CAAC,OAAO,IAAI,aAAa,CAAC,CAAC;AAC5E,CAAC;AAED,MAAM,UAAU,6BAA6B,CAAC,GAAkD;IAC9F,GAAG,CAAC,QAAQ,GAAG,CAAC,CAAC;IACjB,GAAG,CAAC,QAAQ,GAAG,CAAC,CAAC;IACjB,GAAG,CAAC,gBAAgB,GAAG,CAAC,CAAC;IACzB,GAAG,CAAC,UAAU,GAAG,CAAC,CAAC;IACnB,GAAG,CAAC,OAAO,GAAG,CAAC,CAAC;IAChB,GAAG,CAAC,QAAQ,GAAG,CAAC,CAAC;IACjB,GAAG,CAAC,SAAS,GAAG,CAAC,CAAC;IAClB,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC;IACd,GAAG,CAAC,SAAS,GAAG,CAAC,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,eAAkD;IACvF,OAAO,eAAe,CAAC,WAAW,EAAE,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,eAAkD,EAClD,OAAgE,EAChE,OAA6C,EAC7C,OAAkD;IAElD,OAAO,eAAe,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,OAAO,CAAC,CAAC;AACnF,CAAC;AAED,MAAM,aAAa,GAA8B,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flighthq/geolocation",
|
|
3
|
-
"version": "0.5.1-next.
|
|
3
|
+
"version": "0.5.1-next.1345.0995dc5",
|
|
4
4
|
"author": "Joshua Granick and other contributors",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"clean:dist": "tsx ../../scripts/clean-package-dist.ts"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@flighthq/entity": "0.5.1-next.
|
|
42
|
-
"@flighthq/types": "0.5.1-next.
|
|
41
|
+
"@flighthq/entity": "0.5.1-next.1345.0995dc5",
|
|
42
|
+
"@flighthq/types": "0.5.1-next.1345.0995dc5"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"typescript": "^5.3.0"
|
package/src/geolocation.test.ts
CHANGED
|
@@ -10,11 +10,9 @@ import { EntityRuntimeKey } from '@flighthq/types/contract';
|
|
|
10
10
|
import {
|
|
11
11
|
clearGeolocationWatch,
|
|
12
12
|
createGeolocationPosition,
|
|
13
|
-
createWebGeolocationBackend,
|
|
14
13
|
getCurrentGeolocationPosition,
|
|
15
14
|
getCurrentGeolocationPositionResult,
|
|
16
15
|
initializeGeolocationPosition,
|
|
17
|
-
initializeWebGeolocationBackend,
|
|
18
16
|
isGeolocationAvailable,
|
|
19
17
|
watchGeolocationPosition,
|
|
20
18
|
} from './geolocation';
|
|
@@ -88,76 +86,6 @@ describe('createGeolocationPosition', () => {
|
|
|
88
86
|
});
|
|
89
87
|
});
|
|
90
88
|
|
|
91
|
-
describe('createWebGeolocationBackend', () => {
|
|
92
|
-
it('resolves null and does not throw when geolocation is absent', async () => {
|
|
93
|
-
const backend = createWebGeolocationBackend();
|
|
94
|
-
expect(await backend.getCurrentPosition({})).toBeNull();
|
|
95
|
-
expect(typeof backend.watchPosition(() => {}, {})).toBe('number');
|
|
96
|
-
expect(() => backend.clearWatch(-1)).not.toThrow();
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it('getCurrentPositionResult returns unavailable reason when geolocation is absent', async () => {
|
|
100
|
-
const backend = createWebGeolocationBackend();
|
|
101
|
-
const result = await backend.getCurrentPositionResult({});
|
|
102
|
-
expect(result.position).toBeNull();
|
|
103
|
-
expect(result.reason).toBe('unavailable');
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
it('reads a host-provided floorLevel from coords', async () => {
|
|
107
|
-
const hadOwn = Object.prototype.hasOwnProperty.call(navigator, 'geolocation');
|
|
108
|
-
const original =
|
|
109
|
-
Object.getOwnPropertyDescriptor(navigator, 'geolocation') ??
|
|
110
|
-
Object.getOwnPropertyDescriptor(Object.getPrototypeOf(navigator), 'geolocation');
|
|
111
|
-
Object.defineProperty(navigator, 'geolocation', {
|
|
112
|
-
configurable: true,
|
|
113
|
-
value: {
|
|
114
|
-
getCurrentPosition(success: (position: unknown) => void) {
|
|
115
|
-
success({
|
|
116
|
-
coords: {
|
|
117
|
-
accuracy: 5,
|
|
118
|
-
altitude: null,
|
|
119
|
-
altitudeAccuracy: null,
|
|
120
|
-
floorLevel: 3,
|
|
121
|
-
heading: null,
|
|
122
|
-
latitude: 1,
|
|
123
|
-
longitude: 2,
|
|
124
|
-
speed: null,
|
|
125
|
-
},
|
|
126
|
-
timestamp: 123,
|
|
127
|
-
});
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
});
|
|
131
|
-
try {
|
|
132
|
-
const backend = createWebGeolocationBackend();
|
|
133
|
-
const position = await backend.getCurrentPosition({});
|
|
134
|
-
expect(position?.floorLevel).toBe(3);
|
|
135
|
-
} finally {
|
|
136
|
-
if (hadOwn && original !== undefined) {
|
|
137
|
-
Object.defineProperty(navigator, 'geolocation', original);
|
|
138
|
-
} else {
|
|
139
|
-
delete (navigator as { geolocation?: unknown }).geolocation;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
it('reports availability only when geolocation exists in a secure context', () => {
|
|
145
|
-
const backend = createWebGeolocationBackend();
|
|
146
|
-
vi.stubGlobal('navigator', { geolocation: {} });
|
|
147
|
-
vi.stubGlobal('window', { isSecureContext: true });
|
|
148
|
-
expect(backend.isAvailable()).toBe(true);
|
|
149
|
-
|
|
150
|
-
vi.stubGlobal('window', { isSecureContext: false });
|
|
151
|
-
expect(backend.isAvailable()).toBe(false);
|
|
152
|
-
|
|
153
|
-
vi.stubGlobal('navigator', {});
|
|
154
|
-
vi.stubGlobal('window', { isSecureContext: true });
|
|
155
|
-
expect(backend.isAvailable()).toBe(false);
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
afterEach(() => vi.unstubAllGlobals());
|
|
159
|
-
});
|
|
160
|
-
|
|
161
89
|
describe('getCurrentGeolocationPosition', () => {
|
|
162
90
|
it('returns the backend position', async () => {
|
|
163
91
|
const position = (await getCurrentGeolocationPosition(
|
|
@@ -183,11 +111,6 @@ describe('initializeGeolocationPosition', () => {
|
|
|
183
111
|
});
|
|
184
112
|
});
|
|
185
113
|
|
|
186
|
-
describe('initializeWebGeolocationBackend', () => {
|
|
187
|
-
it('is the construction initializer of createWebGeolocationBackend', () => {
|
|
188
|
-
expect(typeof initializeWebGeolocationBackend).toBe('function');
|
|
189
|
-
});
|
|
190
|
-
});
|
|
191
114
|
describe('isGeolocationAvailable', () => {
|
|
192
115
|
it('routes the host backend availability', () => {
|
|
193
116
|
expect(isGeolocationAvailable(hostWith(fakeBackend(true)).system.geolocation)).toBe(true);
|