mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-12-18 18:08:10 +00:00
Migrate some tests to the new htmlRunner
Fix events.get_timeStamp (was events.get_timestamp, wrong casing). Rename `newRunner` to `htmlRunner`. move tests to src/tests (from src/browser/tests). src/runtime and possibly other parts might want to have html tests too.
This commit is contained in:
25
src/tests/crypto.html
Normal file
25
src/tests/crypto.html
Normal file
@@ -0,0 +1,25 @@
|
||||
<script src="testing.js"></script>
|
||||
<script id=crypto>
|
||||
const a = crypto.randomUUID();
|
||||
const b = crypto.randomUUID();
|
||||
testing.expectEqual(36, a.length);
|
||||
testing.expectEqual(36, b.length);
|
||||
testing.expectEqual(false, a == b)
|
||||
|
||||
testing.expectError('Error: QuotaExceededError', () => {
|
||||
crypto.getRandomValues(new BigUint64Array(8193));
|
||||
});
|
||||
|
||||
let r1 = new Int32Array(5)
|
||||
let r2 = crypto.getRandomValues(r1)
|
||||
testing.expectEqual(5, new Set(r1).size);
|
||||
testing.expectEqual(5, new Set(r2).size);
|
||||
testing.expectEqual(true, r1.every((v, i) => v === r2[i]));
|
||||
|
||||
var r3 = new Uint8Array(16);
|
||||
let r4 = crypto.getRandomValues(r3);
|
||||
|
||||
r4[6] = 10;
|
||||
testing.expectEqual(10, r4[6]);
|
||||
testing.expectEqual(10, r3[6]);
|
||||
</script>
|
||||
Reference in New Issue
Block a user