Skip to content

Commit 32bdd9e

Browse files
committed
Fix: update tests.
1 parent b29ff9e commit 32bdd9e

File tree

1 file changed

+14
-31
lines changed
  • server/tests/overall_core

1 file changed

+14
-31
lines changed

server/tests/overall_core/mod.rs

Lines changed: 14 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ async fn test_server_core(
535535
let doc_block_contents = driver_ref.find(By::Css(contents_css)).await.unwrap();
536536
assert_eq!(
537537
doc_block_contents.inner_html().await.unwrap(),
538-
"<p>Testfood</p>\n"
538+
"<p>Testfood</p>"
539539
);
540540
let code_line = driver_ref.find(By::Css(code_line_css)).await.unwrap();
541541
assert_eq!(code_line.inner_html().await.unwrap(), "code()bark");
@@ -564,7 +564,7 @@ async fn test_server_core(
564564
let doc_block_contents = driver_ref.find(By::Css(contents_css)).await.unwrap();
565565
assert_eq!(
566566
doc_block_contents.inner_html().await.unwrap(),
567-
"<p>food</p>\n"
567+
"<p>food</p>"
568568
);
569569
let code_line = driver_ref.find(By::Css(code_line_css)).await.unwrap();
570570
assert_eq!(code_line.inner_html().await.unwrap(), "bark");
@@ -579,33 +579,6 @@ async fn test_server_core(
579579
.await
580580
.unwrap();
581581

582-
// Before changing files, the current file will be updated.
583-
client_id += MESSAGE_ID_INCREMENT;
584-
let msg = codechat_server.get_message_timeout(TIMEOUT).await.unwrap();
585-
let client_version = get_version(&msg);
586-
assert_eq!(
587-
msg,
588-
EditorMessage {
589-
id: client_id,
590-
message: EditorMessageContents::Update(UpdateMessageContents {
591-
file_path: path_str.clone(),
592-
contents: Some(CodeChatForWeb {
593-
metadata: SourceFileMetadata {
594-
mode: "python".to_string()
595-
},
596-
source: CodeMirrorDiffable::Plain(CodeMirror {
597-
doc: " # food\nbark".to_string(),
598-
doc_blocks: vec![]
599-
}),
600-
version: client_version,
601-
}),
602-
cursor_position: Some(1),
603-
scroll_position: Some(1.0),
604-
})
605-
}
606-
);
607-
codechat_server.send_result(client_id, None).await.unwrap();
608-
609582
// These next two messages can come in either order. Work around this.
610583
expected_messages.insert(EditorMessage {
611584
id: current_file_id,
@@ -1126,6 +1099,7 @@ async fn test_client_updates_core(
11261099
message: EditorMessageContents::Result(Ok(ResultOkTypes::Void))
11271100
}
11281101
);
1102+
server_id += MESSAGE_ID_INCREMENT * 2.0;
11291103

11301104
// Target the iframe containing the Client.
11311105
let codechat_iframe = driver_ref.find(By::Css("#CodeChat-iframe")).await.unwrap();
@@ -1174,6 +1148,15 @@ async fn test_client_updates_core(
11741148
}
11751149
);
11761150
codechat_server.send_result(client_id, None).await.unwrap();
1151+
// The Server sends the Client a wrapped version of the text; the Client replies with a Result(Ok).
1152+
assert_eq!(
1153+
codechat_server.get_message_timeout(TIMEOUT).await.unwrap(),
1154+
EditorMessage {
1155+
id: server_id,
1156+
message: EditorMessageContents::Result(Ok(ResultOkTypes::Void))
1157+
}
1158+
);
1159+
server_id += MESSAGE_ID_INCREMENT;
11771160

11781161
// Insert a character to check the insertion point.
11791162
let code_line_css = ".CodeChat-CodeMirror .cm-line";
@@ -1209,8 +1192,8 @@ async fn test_client_updates_core(
12091192
},
12101193
source: CodeMirrorDiffable::Diff(CodeMirrorDiff {
12111194
doc: vec![StringDiff {
1212-
from: 115,
1213-
to: Some(131),
1195+
from: 100,
1196+
to: Some(114),
12141197
insert: " # A comment\n".to_string()
12151198
}],
12161199
doc_blocks: vec![],

0 commit comments

Comments
 (0)