Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# EditorConfig: https://editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

[*.rs]
indent_size = 4

[Makefile]
indent_style = tab
5 changes: 5 additions & 0 deletions src-tauri/clippy.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
disallowed-methods = [
{ path = "std::option::Option::unwrap", reason = "use expect() with a message or handle the None case" },
{ path = "std::result::Result::unwrap", reason = "use expect() with a message or handle the Err case" },
{ path = "std::result::Result::expect", reason = "use proper error handling with AppError" },
]
5 changes: 5 additions & 0 deletions src-tauri/rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
edition = "2021"
max_width = 100
newline_style = "Unix"
use_field_init_shorthand = true
reorder_imports = true
29 changes: 29 additions & 0 deletions src-tauri/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,32 @@ impl From<tauri::Error> for AppError {
Self::Tauri(value.to_string())
}
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn test_not_found_error() {
let err = AppError::NotFound("resource".to_string());
assert_eq!(err.to_string(), "Not found: resource");
}

#[test]
fn test_validation_error() {
let err = AppError::Validation("invalid input".to_string());
assert_eq!(err.to_string(), "Validation error: invalid input");
}

#[test]
fn test_cancelled_error() {
let err = AppError::Cancelled;
assert_eq!(err.to_string(), "Cancelled");
}

#[test]
fn test_error_to_string() {
let err: String = AppError::NotFound("test").into();
assert_eq!(err, "Not found: test");
}
}
20 changes: 20 additions & 0 deletions src-tauri/src/models/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,23 @@ pub use provider::{fixed_base_url, Provider};
pub use provider_model::ProviderModelConfig;
pub use session::Session;
pub use tool_call::ToolCall;


#[cfg(test)]
mod tests {
use super::*;

#[test]
fn test_project_serialization() {
let p = Project {
id: 1,
name: "test-project".to_string(),
path: "/home/test/project".to_string(),
session_count: 0,
last_opened_at: "2025-01-01T00:00:00Z".to_string(),
created_at: "2025-01-01T00:00:00Z".to_string(),
};
let json = serde_json::to_string(&p).unwrap();
assert!(json.contains("test-project"));
}
}
35 changes: 31 additions & 4 deletions src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,48 @@
}
],
"security": {
"csp": null,
"csp": "default-src 'self' blob:; connect-src 'self' https://* http://localhost:*; img-src 'self' data: blob:; style-src 'self' 'unsafe-inline'; script-src 'self'",
"assetProtocol": {
"enable": true
}
}
},
"bundle": {
"active": true,
"targets": "all",
"targets": [
"deb",
"appimage",
"msi",
"nsis"
],
"icon": [
"icons/32x32.png",
"icons/128x128.png",
"icons/128x128@2x.png",
"icons/icon.icns",
"icons/icon.ico"
]
],
"linux": {
"deb": {
"depends": [
"libwebkit2gtk-4.1-0"
],
"section": "devel",
"priority": "optional"
}
},
"windows": {
"certificateThumbprint": null,
"digestAlgorithm": "sha256",
"timestampUrl": ""
}
},
"plugins": {
"updater": {
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDUyNzY4MDdFMzI4RjUwQkMKUldRZnM1L3NMR3dYMFhQb2pZT0ZlK3hZSG9kR1dVZE5lMjVhYU9tZkVtSGN1Qk5hZm5mZjNpU3cK",
"endpoints": [
"https://github.com/kevinnft/enowX-Coder/releases/latest/download/latest.json"
]
}
}
}
}
Loading