MCPcopy Create free account
hub / github.com/awslabs/llrt / test_base64

Function test_base64

modules/llrt_string_decoder/src/lib.rs:118–150  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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() {

Callers

nothing calls this directly

Calls 3

test_async_withFunction · 0.85
initFunction · 0.50
cloneMethod · 0.45

Tested by

no test coverage detected