Skip to content

Commit 94832f3

Browse files
committed
consolidate AMF operation tests
1 parent 664b47c commit 94832f3

2 files changed

Lines changed: 59 additions & 54 deletions

File tree

tests/operations/tests/AMF.mjs

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,63 @@ TestRegister.addTests([
9797
}
9898
],
9999
},
100+
{
101+
name: "AMF3 Encode/Decode: object string",
102+
input: "{\"a\": \"test\"}",
103+
expectedMatch: /"\$value": "a"[\s\S]*"\$value": "test"/,
104+
recipeConfig: [
105+
{
106+
op: "AMF Encode",
107+
args: ["AMF3"]
108+
},
109+
{
110+
op: "AMF Decode",
111+
args: ["AMF3"]
112+
}
113+
],
114+
},
115+
{
116+
name: "AMF3 Decode: empty input error",
117+
input: "",
118+
expectedOutput: "Could not decode AMF3 data: input is empty.",
119+
recipeConfig: [
120+
{
121+
op: "AMF Decode",
122+
args: ["AMF3"]
123+
}
124+
],
125+
},
126+
{
127+
name: "AMF3 Decode: newline input error",
128+
input: "\n",
129+
expectedOutput: "Could not decode AMF3 data. The input may be invalid or incomplete.",
130+
recipeConfig: [
131+
{
132+
op: "AMF Decode",
133+
args: ["AMF3"]
134+
}
135+
],
136+
},
137+
{
138+
name: "AMF3 Decode: truncated object input error",
139+
input: "\x0a\x13\x01\x03a\x05\x40\x08",
140+
expectedOutput: "Could not decode AMF3 data. The input may be invalid or incomplete.",
141+
recipeConfig: [
142+
{
143+
op: "AMF Decode",
144+
args: ["AMF3"]
145+
}
146+
],
147+
},
148+
{
149+
name: "AMF3 Decode: truncated array input error",
150+
input: "\x09\x13\x01\x03a\x05\x40\x08",
151+
expectedOutput: "Could not decode AMF3 data. The input may be invalid or incomplete.",
152+
recipeConfig: [
153+
{
154+
op: "AMF Decode",
155+
args: ["AMF3"]
156+
}
157+
],
158+
},
100159
]);

tests/operations/tests/AMFDecode.mjs

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)