<!DOCTYPE html>
<meta charset="utf-8">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/simple-queue-common.js"></script>
<script>
promise_test(t => {
let lastChunk;
const ws = new WritableStream({
write(chunk) {
lastChunk = chunk;
}
});
const writer = ws.getWriter();
let lastPromise;
// All chunks will be queued.
for (let i = 0; i < QUEUE_MAX_ARRAY_SIZE; ++i) {
lastPromise = writer.write(i);
}
return lastPromise.then(() => {
writer.write('one more');
assert_equals('one more', lastChunk,
'lastChunk should equal "one more"');
});
}, 'push() should still work after emptying exactly one full node');
</script>