()
| 116 | |
| 117 | #[tokio::test] |
| 118 | async fn test_base64() { |
| 119 | test_async_with(|ctx| { |
| 120 | Box::pin(async move { |
| 121 | llrt_buffer::init(&ctx).unwrap(); |
| 122 | ModuleEvaluator::eval_rust::<StringDecoderModule>(ctx.clone(), "string_decoder") |
| 123 | .await |
| 124 | .unwrap(); |
| 125 | |
| 126 | let module = ModuleEvaluator::eval_js( |
| 127 | ctx.clone(), |
| 128 | "test", |
| 129 | r#" |
| 130 | import { StringDecoder } from 'string_decoder'; |
| 131 | |
| 132 | export async function test() { |
| 133 | const decoder = new StringDecoder('base64'); |
| 134 | let res = ""; |
| 135 | res += decoder.write(Buffer.of(0x61)); |
| 136 | res += decoder.end(); |
| 137 | res += decoder.write(Buffer.of()); |
| 138 | res += decoder.end(); |
| 139 | return res; |
| 140 | } |
| 141 | "#, |
| 142 | ) |
| 143 | .await |
| 144 | .unwrap(); |
| 145 | let result = call_test::<String, _>(&ctx, &module, ()).await; |
| 146 | assert_eq!(result, "YQ=="); |
| 147 | }) |
| 148 | }) |
| 149 | .await; |
| 150 | } |
| 151 | |
| 152 | #[tokio::test] |
| 153 | async fn test_utf16le() { |
nothing calls this directly
no test coverage detected