var blob = use('blob'); var utf8 = use('utf8'); return { test_blob_to_text: function() { // Test blob to text conversion var test_string = "Hello, δΈ–η•Œ! 🌍"; var encoded_blob = utf8.encode(test_string); var decoded_text = text(encoded_blob); if (test_string != decoded_text) throw "Blob to text failed" }, test_codepoints_to_text: function() { // Test array of codepoints conversion var test_string = "Hello, δΈ–η•Œ! 🌍"; var codepoints = [72, 101, 108, 108, 111, 44, 32, 19990, 30028, 33, 32, 127757]; var from_codepoints = text(codepoints); if (from_codepoints != test_string) throw "Codepoints to text failed" }, test_array_separator: function() { // Test array with separator var words = ["Hello", "world", "from", "text"]; var joined = text(words, " "); if (joined != "Hello world from text") throw "Array with separator failed" }, test_mixed_array: function() { // Test mixed array with codepoints var mixed = [72, "ello", 32, "world"]; var mixed_result = text(mixed, ""); if (mixed_result != "Hello world") throw "Mixed array test failed" }, }