Skip to content

Commit 661d5b8

Browse files
committed
fix: add test for multiple fallback examples
1 parent 623589a commit 661d5b8

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

src/ExamplePairings/ExamplePairings.test.tsx

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,41 @@ it("renders examples with only schema examples and no method with number", async
234234
, div);
235235
ReactDOM.unmountComponentAtNode(div);
236236
});
237+
it("renders examples with only schema examples and no method with multiple number examples", async () => {
238+
const div = document.createElement("div");
239+
const testDoc: OpenrpcDocument = {
240+
info: {
241+
title: "test",
242+
version: "0.0.0",
243+
},
244+
methods: [
245+
{
246+
name: "test-method",
247+
params: [{
248+
name: "testparam1",
249+
schema: {
250+
examples: [10101, 102],
251+
type: "number",
252+
},
253+
}],
254+
result: {
255+
name: "test-method-result",
256+
schema: {
257+
examples: ["potato", "bar"],
258+
type: "string",
259+
},
260+
},
261+
},
262+
],
263+
openrpc: "1.0.0",
264+
};
265+
ReactDOM.render(
266+
<ExamplePairings
267+
examples={testDoc.methods[0].examples as ExamplePairingObject[]
268+
} />
269+
, div);
270+
ReactDOM.unmountComponentAtNode(div);
271+
});
237272

238273
it("renders examples and can switch between them", async () => {
239274
const simpleMath = await refParser.dereference(examples.simpleMath) as OpenrpcDocument;

0 commit comments

Comments
 (0)