Skip to content

Commit 74ddf9f

Browse files
shusann01116syphar
authored andcommitted
Add a test to check if the error message exists
1 parent 7828836 commit 74ddf9f

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/web/source.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -737,4 +737,23 @@ mod tests {
737737
Ok(())
738738
});
739739
}
740+
741+
#[test]
742+
fn large_file_test() {
743+
wrapper(|env| {
744+
env.fake_release()
745+
.name("fake")
746+
.version("0.1.0")
747+
.source_file("large_file.rs", &[0; 50 * 1024 * 1024 + 1]) // 50MB + 1 byte
748+
.create()?;
749+
750+
let web = env.frontend();
751+
let response = web.get("/crate/fake/0.1.0/source/large_file.rs").send()?;
752+
assert_eq!(response.status(), StatusCode::OK);
753+
assert!(response
754+
.text()?
755+
.contains("This file is too large to display"));
756+
Ok(())
757+
});
758+
}
740759
}

0 commit comments

Comments
 (0)