Skip to content

Commit 1bb6546

Browse files
committed
consolidate AMF operation tests
1 parent 98612b2 commit 1bb6546

3 files changed

Lines changed: 59 additions & 55 deletions

File tree

tests/operations/index.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import TestRegister from "../lib/TestRegister.mjs";
1818
import "./tests/A1Z26CipherDecode.mjs";
1919
import "./tests/AESKeyWrap.mjs";
2020
import "./tests/AMF.mjs";
21-
import "./tests/AMFDecode.mjs";
2221
import "./tests/AnalyseUUID.mjs";
2322
import "./tests/AlternatingCaps.mjs";
2423
import "./tests/AvroToJSON.mjs";

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 nested JSON values",
102+
input: "{\"a\": [true, false, null, \"x\", 1]}",
103+
expectedMatch: /"sealedMemberNames": \[[\s\S]*"\$value": "a"[\s\S]*"\$values": \[[\s\S]*"marker": 3[\s\S]*"marker": 2[\s\S]*"marker": 1[\s\S]*"\$value": "x"[\s\S]*"\$value": 1/,
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)