mirror of https://github.com/zulip/zulip.git
submessage: Replace bogus test data with valid objects.
The test data was not the correct representation of submessage's content field. This caused the zod schema to throw error. This is a temporary solution and eventually we have to move to an efficient approach making the test data more representative and accurate. Discussion: https://chat.zulip.org/#narrow/stream/6-frontend/topic/TypeScript.20migration/near/1766122
This commit is contained in:
parent
f1db30418b
commit
894756addc
|
@ -23,8 +23,12 @@ run_test("get_message_events", () => {
|
||||||
assert.equal(submessage.get_message_events(msg), undefined);
|
assert.equal(submessage.get_message_events(msg), undefined);
|
||||||
|
|
||||||
const submessages = [
|
const submessages = [
|
||||||
{id: 222, sender_id: 99, content: "84"},
|
{id: 222, sender_id: 99, content: '{"type":"new_option","idx":1,"option":"bar"}'},
|
||||||
{id: 9, sender_id: 33, content: "42"},
|
{
|
||||||
|
id: 9,
|
||||||
|
sender_id: 33,
|
||||||
|
content: '{"widget_type": "poll", "extra_data": {"question": "foo", "options": []}}',
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
msg = {
|
msg = {
|
||||||
|
@ -37,8 +41,24 @@ run_test("get_message_events", () => {
|
||||||
submessages,
|
submessages,
|
||||||
};
|
};
|
||||||
assert.deepEqual(submessage.get_message_events(msg), [
|
assert.deepEqual(submessage.get_message_events(msg), [
|
||||||
{sender_id: 33, data: 42},
|
{
|
||||||
{sender_id: 99, data: 84},
|
sender_id: 33,
|
||||||
|
data: {
|
||||||
|
widget_type: "poll",
|
||||||
|
extra_data: {
|
||||||
|
question: "foo",
|
||||||
|
options: [],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sender_id: 99,
|
||||||
|
data: {
|
||||||
|
type: "new_option",
|
||||||
|
idx: 1,
|
||||||
|
option: "bar",
|
||||||
|
},
|
||||||
|
},
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -73,7 +93,13 @@ run_test("check sender", ({override}) => {
|
||||||
const message = {
|
const message = {
|
||||||
id: message_id,
|
id: message_id,
|
||||||
sender_id: 1,
|
sender_id: 1,
|
||||||
submessages: [{sender_id: 2, content: "{}"}],
|
submessages: [
|
||||||
|
{
|
||||||
|
sender_id: 2,
|
||||||
|
content:
|
||||||
|
'{"widget_type": "poll", "extra_data": {"question": "foo", "options": []}}',
|
||||||
|
},
|
||||||
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
override(message_store, "get", (arg) => {
|
override(message_store, "get", (arg) => {
|
||||||
|
|
Loading…
Reference in New Issue