-
Notifications
You must be signed in to change notification settings - Fork 0
test: add unit tests for attention timer, break scheduler and the whole state machine #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
5a8291c
feat: add event emission abstraction for scheduler testing
pilgrimlyieu 453fdb3
feat: add mini break counter to `SchedulerStatus` for tracking long b…
pilgrimlyieu c84e2ce
build: add test utils & update `build.rs` for Windows testing
pilgrimlyieu 3a0170c
feat: add runtime and event emitter generics for dependency Injection
pilgrimlyieu bf65e1b
feat(test): add test helpers and utilities for scheduler testing
pilgrimlyieu 1ec2e23
refactor: refactor and extract methods for better testing
pilgrimlyieu 60c1ddb
test: add comprehensive tests for pause reasons and session management
pilgrimlyieu 4b76581
test: add unit tests for attention timer and enhance test helpers
pilgrimlyieu 162ab2b
refactor(test): add `naive_time` helper for improved readability in t…
pilgrimlyieu ea181a9
test: add unit tests for break scheduler
pilgrimlyieu 8d465a5
refactor: rename break windows to prompt windows
pilgrimlyieu a127819
feat: implement session management for all monitors
pilgrimlyieu 884a9ba
refactor: export utility function from `SchedulerManager` for testing
pilgrimlyieu bd932c0
test: add attention timer tests & update test helpers
pilgrimlyieu b6922f8
test: add break scheduler tests
pilgrimlyieu fbbe278
test: add manager integration tests
pilgrimlyieu 13f4405
test: add monitor integration tests
pilgrimlyieu ada883e
test: add stress tests
pilgrimlyieu 39baf21
refactor: avoid duplicating schedule lookup logic
pilgrimlyieu 5f9c398
refactor: improve `build.rs` comments
pilgrimlyieu a655cb2
build: remove sccache build configuration
pilgrimlyieu 497a887
refactor: reuse event emitter in test environment
pilgrimlyieu af8512e
build: try to fix CI errors
pilgrimlyieu 510a4b0
refactor: optimize code readability
pilgrimlyieu 9d2647c
build: fix CI complaining
pilgrimlyieu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,19 @@ | ||
| # Use lld linker on Linux and Windows for faster linking | ||
| # macOS doesn't support lld, it uses ld64 | ||
| # macOS doesn't support lld. | ||
| [target.x86_64-unknown-linux-gnu] | ||
| rustflags = ["-C", "link-arg=-fuse-ld=lld"] | ||
|
|
||
| [target.aarch64-unknown-linux-gnu] | ||
| rustflags = ["-C", "link-arg=-fuse-ld=lld"] | ||
|
|
||
| [target.x86_64-pc-windows-msvc] | ||
| rustflags = ["-C", "link-arg=-fuse-ld=lld"] | ||
| linker = "rust-lld" | ||
|
|
||
| [target.aarch64-pc-windows-msvc] | ||
| rustflags = ["-C", "link-arg=-fuse-ld=lld"] | ||
| linker = "rust-lld" | ||
|
|
||
| [env] | ||
| TS_RS_EXPORT_DIR = { value = "src/types/generated", relative = true } | ||
| # workaround needed to prevent `STATUS_ENTRYPOINT_NOT_FOUND` error in tests | ||
| # see https://github.com/tauri-apps/tauri/pull/4383#issuecomment-1212221864 | ||
| __TAURI_WORKSPACE__ = "true" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,35 @@ | ||
| // https://github.com/tauri-apps/tauri/issues/13419#issuecomment-3398457618 | ||
| // Fix `STATUS_ENTRYPOINT_NOT_FOUND` error on Windows when testing. | ||
| fn main() { | ||
| tauri_build::build() | ||
| #[cfg(windows)] | ||
| { | ||
| let mut attributes = tauri_build::Attributes::new(); | ||
| attributes = attributes | ||
| .windows_attributes(tauri_build::WindowsAttributes::new_without_app_manifest()); | ||
| add_manifest(); | ||
| tauri_build::try_build(attributes).unwrap(); | ||
| } | ||
| #[cfg(not(windows))] | ||
| { | ||
| tauri_build::build(); | ||
| } | ||
| } | ||
|
|
||
| #[cfg(windows)] | ||
| fn add_manifest() { | ||
| static WINDOWS_MANIFEST_FILE: &str = "windows-app-manifest.xml"; | ||
|
|
||
| let manifest = std::env::current_dir() | ||
| .expect("Failed to get current directory during build") | ||
| .join(WINDOWS_MANIFEST_FILE); | ||
|
|
||
| println!("cargo:rerun-if-changed={}", manifest.display()); | ||
| // Embed the Windows application manifest file. | ||
| println!("cargo:rustc-link-arg=/MANIFEST:EMBED"); | ||
| println!( | ||
| "cargo:rustc-link-arg=/MANIFESTINPUT:{}", | ||
| manifest.to_str().unwrap() | ||
| ); | ||
pilgrimlyieu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| // Turn linker warnings into errors. | ||
| println!("cargo:rustc-link-arg=/WX"); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.