fix(native): new lint warnings and the MapLibre protocol type after the dev merge

Awaits that sat in loops in the native-auth tests run together, the hand-off hook marks its navigations as ignored, the native tests drop their non-null assertions, and the offline protocol answers with the data type MapLibre 6.15 expects.
This commit is contained in:
Maurice
2026-10-25 17:16:02 +01:00
parent 8b6a65023f
commit a3b04887a1
6 changed files with 17 additions and 15 deletions
+1 -3
View File
@@ -129,9 +129,7 @@ describe('Native sign-in hand-off e2e', () => {
});
it('NATIVE-E2E-005: rate-limits the exchange per ip', async () => {
for (let i = 0; i < 20; i++) {
await exchange({ code: `nope-${i}`, verifier });
}
await Promise.all(Array.from({ length: 20 }, (_, i) => exchange({ code: `nope-${i}`, verifier })));
const blocked = await exchange({ code: 'nope', verifier });
expect(blocked.status).toBe(429);
});
@@ -130,16 +130,17 @@ describe('InMemoryNativeHandoffStore', () => {
it('NATIVE-STORE-001: holds at most its cap of live codes', async () => {
const store = new InMemoryNativeHandoffStore();
const later = Date.now() + 60_000;
for (let i = 0; i < MAX_PENDING_HANDOFFS; i++) {
expect(await store.put(`c${i}`, entry(later))).toBe(true);
}
const stored = await Promise.all(
Array.from({ length: MAX_PENDING_HANDOFFS }, (_, i) => store.put(`c${i}`, entry(later))),
);
expect(stored.every(Boolean)).toBe(true);
expect(await store.put('one-too-many', entry(later))).toBe(false);
});
it('NATIVE-STORE-002: expired codes are dropped on the next write and make room', async () => {
const store = new InMemoryNativeHandoffStore();
const past = Date.now() - 1;
for (let i = 0; i < MAX_PENDING_HANDOFFS; i++) await store.put(`c${i}`, entry(past));
await Promise.all(Array.from({ length: MAX_PENDING_HANDOFFS }, (_, i) => store.put(`c${i}`, entry(past))));
expect(await store.put('fresh', entry(Date.now() + 60_000))).toBe(true);
expect(await store.take('c0')).toBeNull();