node fixtures: Add more realistic data for typing.

This commit is contained in:
Steve Howell
2020-07-25 20:58:18 +00:00
committed by Steve Howell
parent b4a4f9d568
commit b63c7d1cbb
2 changed files with 22 additions and 17 deletions

View File

@@ -5,6 +5,7 @@ const events = require("./lib/events.js");
const event_fixtures = events.fixtures;
const test_message = events.test_message;
const test_user = events.test_user;
const typing_person1 = events.typing_person1;
set_global("$", global.make_zjquery());
@@ -625,7 +626,7 @@ with_overrides((override) => {
override("typing_events.display_notification", stub.f);
dispatch(event);
const args = stub.get_args("event");
assert_same(args.event.sender.user_id, 4);
assert_same(args.event.sender.user_id, typing_person1.user_id);
});
event = event_fixtures.typing__stop;
@@ -633,11 +634,11 @@ with_overrides((override) => {
override("typing_events.hide_notification", stub.f);
dispatch(event);
const args = stub.get_args("event");
assert_same(args.event.sender.user_id, 6);
assert_same(args.event.sender.user_id, typing_person1.user_id);
});
page_params.user_id = 5;
event = event_fixtures.typing__self;
page_params.user_id = typing_person1.user_id;
event = event_fixtures.typing__start;
dispatch(event); // get line coverage
});

View File

@@ -17,6 +17,19 @@ exports.test_message = {
id: 99,
};
const typing_person1 = {
user_id: 1,
email: "user1@example.com",
};
const typing_person2 = {
user_id: 2,
email: "user2@example.com",
};
exports.typing_person1 = typing_person1;
exports.typing_person2 = typing_person2;
const streams = {
devel: {
name: "devel",
@@ -446,25 +459,16 @@ exports.fixtures = {
typing__start: {
type: "typing",
sender: {
user_id: 4,
},
op: "start",
sender: typing_person1,
recipients: [typing_person2],
},
typing__stop: {
type: "typing",
sender: {
user_id: 6,
},
op: "stop",
},
typing__self: {
type: "typing",
sender: {
user_id: 5,
},
sender: typing_person1,
recipients: [typing_person2],
},
update_display_settings__default_language: {