Fix test_channel_messages unit test

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra 2021-09-15 12:15:54 +02:00
parent f6bf0792ce
commit 914112f2b5

View file

@ -510,6 +510,21 @@ mod tests {
let channel_list = cx.add_model(|cx| ChannelList::new(user_store, client.clone(), cx)); let channel_list = cx.add_model(|cx| ChannelList::new(user_store, client.clone(), cx));
channel_list.read_with(&cx, |list, _| assert_eq!(list.available_channels(), None)); channel_list.read_with(&cx, |list, _| assert_eq!(list.available_channels(), None));
let get_users = server.receive::<proto::GetUsers>().await.unwrap();
assert_eq!(get_users.payload.user_ids, vec![5]);
server
.respond(
get_users.receipt(),
proto::GetUsersResponse {
users: vec![proto::User {
id: 5,
github_login: "nathansobo".into(),
avatar_url: "http://avatar.com/nathansobo".into(),
}],
},
)
.await;
// Get the available channels. // Get the available channels.
let get_channels = server.receive::<proto::GetChannels>().await.unwrap(); let get_channels = server.receive::<proto::GetChannels>().await.unwrap();
server server
@ -569,23 +584,16 @@ mod tests {
// Client requests all users for the received messages // Client requests all users for the received messages
let mut get_users = server.receive::<proto::GetUsers>().await.unwrap(); let mut get_users = server.receive::<proto::GetUsers>().await.unwrap();
get_users.payload.user_ids.sort(); get_users.payload.user_ids.sort();
assert_eq!(get_users.payload.user_ids, vec![5, 6]); assert_eq!(get_users.payload.user_ids, vec![6]);
server server
.respond( .respond(
get_users.receipt(), get_users.receipt(),
proto::GetUsersResponse { proto::GetUsersResponse {
users: vec![ users: vec![proto::User {
proto::User { id: 6,
id: 5, github_login: "maxbrunsfeld".into(),
github_login: "nathansobo".into(), avatar_url: "http://avatar.com/maxbrunsfeld".into(),
avatar_url: "http://avatar.com/nathansobo".into(), }],
},
proto::User {
id: 6,
github_login: "maxbrunsfeld".into(),
avatar_url: "http://avatar.com/maxbrunsfeld".into(),
},
],
}, },
) )
.await; .await;