|
1 | 1 | open Webapi.Blob |
2 | 2 |
|
3 | | -let test_arrayBuffer = blob => |
4 | | - blob |
| 3 | +let test_blob: t = make([]) |
| 4 | + |
| 5 | +let test_arrayBuffer: Js.Promise.t<int> = |
| 6 | + test_blob |
5 | 7 | ->arrayBuffer |
6 | | - ->Promise.then(buffer => |
7 | | - buffer->Js.Typed_array.ArrayBuffer.byteLength->Js.log->Promise.resolve |
8 | | - ) |
| 8 | + ->Promise.thenResolve(buffer => buffer->Js.Typed_array.ArrayBuffer.byteLength) |
9 | 9 |
|
10 | | -let test_size = blob => blob->size->Js.log |
| 10 | +let test_size: float = test_blob->size |
11 | 11 |
|
12 | | -let test_slice = blob => test_size(blob->slice(~start=0, ())) |
| 12 | +let test_slice: t = test_blob->slice(~start=0, ()) |
13 | 13 |
|
14 | | -let test_stream = blob => blob->stream |
| 14 | +let test_stream: Webapi.ReadableStream.t = test_blob->stream |
15 | 15 |
|
16 | | -let test_text = blob => blob->text->Promise.then(string => string->Js.log->Promise.resolve) |
| 16 | +let test_text: Js.Promise.t<unit> = |
| 17 | + test_blob->text->Promise.then(string => string->Js.log->Promise.resolve) |
17 | 18 |
|
18 | | -let test_type = blob => blob->type_->Js.log |
| 19 | +let test_type: string = test_blob->type_ |
19 | 20 |
|
20 | | -let test_blobPropertyBag: blobPropertyBag = makeBlobPropertyBag(~_type="text/plain", ~endings=#transparent, ()) |
| 21 | +let test_blobPropertyBag: blobPropertyBag = makeBlobPropertyBag( |
| 22 | + ~_type="text/plain", |
| 23 | + ~endings=#transparent, |
| 24 | + (), |
| 25 | +) |
21 | 26 | let test_blobPropertyBagTypeOnly: blobPropertyBag = makeBlobPropertyBag(~_type="text/plain", ()) |
22 | 27 | let test_blobPropertyBagNone: blobPropertyBag = makeBlobPropertyBag() |
23 | 28 |
|
24 | 29 | let test_blobPart_string: blobPart = stringToBlobPart("hello") |
25 | 30 | let test_blobPart_blob: blobPart = blobToBlobPart(make([])) |
26 | | -let test_blobPart_arrayBuffer: t => Promise.t<blobPart> = blob => |
27 | | - blob |
28 | | - ->arrayBuffer |
29 | | - ->Promise.then(buffer => |
30 | | - buffer->arrayBufferToBlobPart->Promise.resolve |
31 | | - ) |
| 31 | +let test_blobPart_arrayBuffer: Promise.t<blobPart> = |
| 32 | + test_blob->arrayBuffer->Promise.then(buffer => buffer->arrayBufferToBlobPart->Promise.resolve) |
| 33 | + |
32 | 34 | let test_blobPart_int8Array: blobPart = int8ArrayToBlobPart(Js.Typed_array.Int8Array.fromLength(10)) |
33 | | -let test_blobPart_uint8Array: blobPart = uint8ArrayToBlobPart(Js.Typed_array.Uint8Array.fromLength(10)) |
34 | | -let test_blobPart_uint8ClampedArray: blobPart = uint8ClampedArrayToBlobPart(Js.Typed_array.Uint8ClampedArray.fromLength(10)) |
35 | | -let test_blobPart_int16Array: blobPart = int16ArrayToBlobPart(Js.Typed_array.Int16Array.fromLength(10)) |
36 | | -let test_blobPart_int32Array: blobPart = int32ArrayToBlobPart(Js.Typed_array.Int32Array.fromLength(10)) |
37 | | -let test_blobPart_uint32Array: blobPart = uint32ArrayToBlobPart(Js.Typed_array.Uint32Array.fromLength(10)) |
| 35 | +let test_blobPart_uint8Array: blobPart = uint8ArrayToBlobPart( |
| 36 | + Js.Typed_array.Uint8Array.fromLength(10), |
| 37 | +) |
| 38 | +let test_blobPart_uint8ClampedArray: blobPart = uint8ClampedArrayToBlobPart( |
| 39 | + Js.Typed_array.Uint8ClampedArray.fromLength(10), |
| 40 | +) |
| 41 | +let test_blobPart_int16Array: blobPart = int16ArrayToBlobPart( |
| 42 | + Js.Typed_array.Int16Array.fromLength(10), |
| 43 | +) |
| 44 | +let test_blobPart_int32Array: blobPart = int32ArrayToBlobPart( |
| 45 | + Js.Typed_array.Int32Array.fromLength(10), |
| 46 | +) |
| 47 | +let test_blobPart_uint32Array: blobPart = uint32ArrayToBlobPart( |
| 48 | + Js.Typed_array.Uint32Array.fromLength(10), |
| 49 | +) |
38 | 50 | let test_blobPart_float32: blobPart = float32ToBlobPart(Js.Typed_array.Float32Array.fromLength(10)) |
39 | | -let test_blobPart_float64Array: blobPart = float64ArrayToBlobPart(Js.Typed_array.Float64Array.fromLength(10)) |
40 | | -let test_blobPart_dataView: t => Promise.t<blobPart> = (blob) => blob |
| 51 | +let test_blobPart_float64Array: blobPart = float64ArrayToBlobPart( |
| 52 | + Js.Typed_array.Float64Array.fromLength(10), |
| 53 | +) |
| 54 | +let test_blobPart_dataView: Promise.t<blobPart> = |
| 55 | + test_blob |
41 | 56 | ->arrayBuffer |
42 | 57 | ->Promise.then(buffer => |
43 | 58 | dataViewToBlobPart(Js.Typed_array.DataView.make(buffer))->Promise.resolve |
44 | 59 | ) |
45 | 60 |
|
46 | | -let test_blob: t = make([]) |
47 | 61 | let test_blobWithOptions: t = makeWithOptions([stringToBlobPart("hello")], makeBlobPropertyBag()) |
0 commit comments