simplify application and remove window references
Sonarqube Scanner / Build and analyze (push) Failing after 1m27s

This commit is contained in:
Florian Zumpe
2026-06-17 16:08:01 +02:00
parent 6a4d84ac6a
commit 32f161483d
20 changed files with 560 additions and 282 deletions
+9 -7
View File
@@ -14,11 +14,11 @@ test('legacy vibration patterns are exposed as immutable constants', async () =>
const calls = [];
const context = {
navigator: { vibrate: pattern => { calls.push(pattern); return true; } },
window: { Wegwichtel: {} }
Wegwichtel: {}
};
vm.runInNewContext(await source(), context);
const vibration = context.window.Wegwichtel.Vibration;
const vibration = context.Wegwichtel.Vibration;
assert.equal(vibration.Patterns.MICRO, 50);
assert.equal(vibration.Patterns.MINI, 100);
@@ -34,26 +34,28 @@ test('vibration wrapper starts named patterns and can cancel them', async () =>
const calls = [];
const context = {
navigator: { vibrate: pattern => { calls.push(pattern); return true; } },
window: { Wegwichtel: {} }
Wegwichtel: {}
};
vm.runInNewContext(await source(), context);
const vibration = context.window.Wegwichtel.Vibration;
const vibration = context.Wegwichtel.Vibration;
assert.equal(vibration.start(vibration.Patterns.ACTIVE_POI), true);
assert.equal(vibration.start(vibration.Patterns.SHORT), true);
assert.equal(vibration.stop(), true);
assert.deepEqual(Array.from(calls[0]), [500, 300, 500]);
assert.equal(calls[1], 0);
assert.deepEqual(Array.from(calls[1]), [200]);
assert.equal(calls[2], 0);
});
test('vibration wrapper fails harmlessly when the browser API is unavailable', async () => {
const context = {
navigator: {},
window: { Wegwichtel: {} }
Wegwichtel: {}
};
vm.runInNewContext(await source(), context);
const vibration = context.window.Wegwichtel.Vibration;
const vibration = context.Wegwichtel.Vibration;
assert.equal(vibration.isSupported(), false);
assert.equal(vibration.start(vibration.Patterns.SHORT), false);