Skip to content

Commit

Permalink
feat: fixed fairing removal on tests
Browse files Browse the repository at this point in the history
  • Loading branch information
thibault-cne committed Apr 16, 2024
1 parent 83771ae commit a6c65d5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions crates/api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ mod races;
mod seasons;
mod status;

#[cfg(not(test))]
pub fn rocket_builder() -> Rocket<Build> {
rocket::build()
.attach(fairings::helmet::Formula1Helmet)
Expand All @@ -30,8 +29,7 @@ pub fn rocket_builder() -> Rocket<Build> {
))
}

#[cfg(test)]
pub fn rocket_builder() -> Rocket<Build> {
pub fn rocket_builder_no_fairings() -> Rocket<Build> {
rocket::build()
.mount("/api", handlers::handlers())
.mount("/fallback", fallbacks::handlers())
Expand Down
4 changes: 2 additions & 2 deletions tests-integration/tests/common/mod.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use rocket::http::uri::Origin;
use rocket::local::blocking::{Client, LocalResponse};

use api_lib::rocket_builder;
use api_lib::rocket_builder_no_fairings;

pub fn setup() -> Client {
Client::tracked(rocket_builder()).expect("invalid rocket instance")
Client::tracked(rocket_builder_no_fairings()).expect("invalid rocket instance")
}

pub fn get<'c, U>(client: &'c Client, uri: U) -> LocalResponse<'c>
Expand Down

0 comments on commit a6c65d5

Please sign in to comment.