switch test wasm plugin to version that does not require WASI

This commit is contained in:
Joel Wetzell
2026-03-17 12:06:12 -05:00
parent 97c1975c7f
commit b17e0489a5
2 changed files with 12 additions and 17 deletions

Binary file not shown.

View File

@@ -1,7 +1,7 @@
package processor_test
import (
"slices"
"reflect"
"testing"
"github.com/jwetzell/showbridge-go/internal/common"
@@ -34,15 +34,14 @@ func TestScriptWASMFromRegistry(t *testing.T) {
func TestGoodScriptWASM(t *testing.T) {
tests := []struct {
name string
payload []byte
payload any
params map[string]any
expected []byte
expected any
}{
{
name: "string input, default process function with wasi",
params: map[string]any{
"path": "good.wasm",
"enableWasi": true,
},
payload: []byte("hello"),
expected: []byte("Processed: hello"),
@@ -51,7 +50,6 @@ func TestGoodScriptWASM(t *testing.T) {
name: "string input, specified function with wasi",
params: map[string]any{
"path": "good.wasm",
"enableWasi": true,
"function": "greet",
},
payload: []byte("world"),
@@ -86,7 +84,7 @@ func TestGoodScriptWASM(t *testing.T) {
t.Fatalf("script.wasm returned a %T payload: %+v", got, got)
}
if !slices.Equal(gotBytes, test.expected) {
if !reflect.DeepEqual(gotBytes, test.expected) {
t.Fatalf("script.wasm got %+v, expected %+v", gotBytes, test.expected)
}
})
@@ -118,7 +116,6 @@ func TestBadScriptWASM(t *testing.T) {
name: "non-string function",
params: map[string]any{
"path": "good.wasm",
"enableWasi": true,
"function": 12345,
},
payload: []byte("hello"),
@@ -137,7 +134,6 @@ func TestBadScriptWASM(t *testing.T) {
name: "non-byte slice input",
params: map[string]any{
"path": "good.wasm",
"enableWasi": true,
},
payload: "hello",
errorString: "script.wasm can only process a byte array",
@@ -146,7 +142,6 @@ func TestBadScriptWASM(t *testing.T) {
name: "function not found in module",
params: map[string]any{
"path": "good.wasm",
"enableWasi": true,
"function": "asdf",
},
payload: []byte("hello"),