Skip to content

test: remove sample images#20

Closed
LuigimonSoft wants to merge 1 commit intomasterfrom
codex/add-static-file-server-support
Closed

test: remove sample images#20
LuigimonSoft wants to merge 1 commit intomasterfrom
codex/add-static-file-server-support

Conversation

@LuigimonSoft
Copy link
Owner

Summary

  • drop sample PNG and JPG files from static assets
  • adjust static file tests to verify serving index.html

Testing

  • SWAGGER_UI_DOWNLOAD_URL=file://$(pwd)/swagger-ui.zip cargo test (fails: invalid zip header)

https://chatgpt.com/codex/tasks/task_e_68a15462425883209ee6af91b9702e42

Copilot AI review requested due to automatic review settings August 17, 2025 21:56
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR removes sample images from static assets and replaces them with a proper static file serving infrastructure. The changes introduce HTML file serving capabilities and comprehensive test coverage for static file functionality.

  • Removes sample PNG/JPG files and adds index.html static file serving
  • Refactors integration tests to use simpler server lifecycle management
  • Adds dedicated static file test coverage with proper HTML content verification

Reviewed Changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/test/static_files_test.rs New test file for static file serving functionality
src/test/mod.rs Registers the new static files test module
src/test/integration_test.rs Simplifies server management and adds static file integration test
src/server.rs Integrates static file serving and moves error handling to top level
src/router.rs Updates error handling to use Rejection instead of Infallible
src/controllers/mod.rs Updates return type to use Rejection for proper error propagation
src/config.rs Adds static_dir configuration field
public/index.html New HTML file for static serving tests
README.md Documents new static file serving feature

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

.and(warp::get())
.and_then(|| async {
Ok::<_, Rejection>(warp::reply::json(&swagger::ApiDoc::openapi()))
});
Copy link

Copilot AI Aug 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The closure should be simplified to use warp::reply::json directly without the unnecessary async block and Result wrapping.

Suggested change
});
.map(|| warp::reply::json(&swagger::ApiDoc::openapi()));

Copilot uses AI. Check for mistakes.
let response = client.get(address).send().await.unwrap();
assert_eq!(response.status(), 200);
let body = response.text().await.unwrap();
assert!(body.contains("Static file served"));
Copy link

Copilot AI Aug 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] This assertion duplicates the same check in static_files_test.rs. Consider extracting this into a shared test helper or constant to avoid duplication.

Suggested change
assert!(body.contains("Static file served"));
assert!(body.contains(STATIC_FILE_SERVED_TEXT));

Copilot uses AI. Check for mistakes.
@LuigimonSoft LuigimonSoft deleted the codex/add-static-file-server-support branch August 19, 2025 01:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants