fix arena, add fetch test

This commit is contained in:
Karl Seguin
2025-09-16 08:39:46 +08:00
committed by Muki Kiboigo
parent ed11eab0a7
commit cd763a7a35
3 changed files with 33 additions and 1 deletions

View File

@@ -0,0 +1,16 @@
<script src="../testing.js"></script>
<script id=fetch type=module>
const promise1 = new Promise((resolve) => {
fetch('http://127.0.0.1:9582/xhr/json')
.then((res) => {
return res.json()
})
.then((json) => {
resolve(json);
});
});
testing.async(promise1, (json) => {
testing.expectEqual({over: '9000!!!'}, json);
});
</script>

View File

@@ -36,3 +36,14 @@
let emptyResponse = new Response("");
testing.expectEqual(200, emptyResponse.status);
</script>
<script id=json type=module>
const promise1 = new Promise((resolve) => {
let response = new Response('[]');
response.json().then(resolve)
});
testing.async(promise1, (json) => {
testing.expectEqual([], json);
});
</script>ref