Fix test assertions in database module to use array indexing for results

format rust code
This commit is contained in:
Huakun Shen 2025-03-27 00:43:29 -04:00
parent 5d5cbcdeb7
commit bf6aa1b419
No known key found for this signature in database
6 changed files with 10 additions and 15 deletions

View File

@ -1108,8 +1108,8 @@ mod tests {
)
.unwrap();
assert_eq!(results.len(), 1);
assert_eq!(results[0]["title"], "Buy groceries");
assert_eq!(results[0]["completed"], "false");
assert_eq!(results[0][0], "Buy groceries");
assert_eq!(results[0][1], "false");
// Test execute with UPDATE
let (rows_affected, _) = db
@ -1127,7 +1127,7 @@ mod tests {
vec![json!(1)],
)
.unwrap();
assert_eq!(results[0]["completed"], "true");
assert_eq!(results[0][0], "true");
// Test execute with DELETE
let (rows_affected, _) = db
@ -1139,7 +1139,7 @@ mod tests {
let results = db
.select("SELECT COUNT(*) as count FROM todos".to_string(), vec![])
.unwrap();
assert_eq!(results[0]["count"], 0);
assert_eq!(results[0][0], 0);
fs::remove_file(&db_path).unwrap();
}

View File

@ -1,3 +1,4 @@
## Permission Table
<table>
@ -6,6 +7,7 @@
<th>Description</th>
</tr>
<tr>
<td>

View File

@ -1,4 +1,3 @@
pub struct AppState {
// pub history: Mutex<Vec<Record>>,
// pub dev_extension_path: Mutex<Option<PathBuf>>,

View File

@ -2,10 +2,7 @@
// use hello_world::{HelloReply, HelloRequest};
// use server_info«::server_info_server::ServerInfo;
// use server_info::{InfoRequest, InfoResponse};
use grpc::kunkun::{
kunkun_server::Kunkun,
Empty, ServerInfoResponse,
};
use grpc::kunkun::{kunkun_server::Kunkun, Empty, ServerInfoResponse};
use tauri::{AppHandle, Emitter, Manager};
use tonic::{Request, Response, Status};

View File

@ -6,8 +6,7 @@ use axum::routing::{get, post};
use axum_server::tls_rustls::RustlsConfig;
use base64::prelude::*;
use grpc::{
file_transfer::file_transfer_server::FileTransferServer,
kunkun::kunkun_server::KunkunServer,
file_transfer::file_transfer_server::FileTransferServer, kunkun::kunkun_server::KunkunServer,
};
/// This module is responsible for controlling the main server
use obfstr::obfstr as s;

View File

@ -3,10 +3,8 @@ use super::{
model::{ServerInfo, ServerState},
};
use crate::{
constants::KUNKUN_REFRESH_WORKER_EXTENSION,
models::FileTransferState,
server::model::FileTransferProgressPayload,
JarvisState,
constants::KUNKUN_REFRESH_WORKER_EXTENSION, models::FileTransferState,
server::model::FileTransferProgressPayload, JarvisState,
};
use axum::{
body::StreamBody,