Skip to content

Commit

Permalink
🎨 cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Goodjooy committed Nov 29, 2024
1 parent 44bb5fb commit 2f3accc
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions persistence/dao/ceobe-operate/src/mongo/release_version/retrieve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,22 +115,22 @@ where
fn generate_platform_filter_document(
platform: Option<ReleasePlatform>, deleted: bool,
) -> Result<Document> {
Ok(match (platform,deleted) {
(None,false) => {
Ok(match (platform, deleted) {
(None, false) => {
doc! {
"deleted": false
}
}
(Some(plat),false) => {
(Some(plat), false) => {
doc! {
"platform":to_bson(&plat)?,
"deleted": false
}
}
(None,true)=>{
(None, true) => {
doc! {}
}
(Some(plat),true)=>{
(Some(plat), true) => {
doc! {
"platform":to_bson(&plat)?,
}
Expand All @@ -156,19 +156,23 @@ mod test {
mongodb::bson::doc,
};
use mongo_migration::Migrator;
use crate::release_version::retrieve::generate_platform_filter_document;
use crate::ToCeobeOperation;


use crate::{
release_version::retrieve::generate_platform_filter_document,
ToCeobeOperation,
};

#[test]
fn test_deleted_filter(){
let doc = generate_platform_filter_document(Some(Desktop),false).expect("Err");
assert_eq!(doc,doc! {"platform": "desktop","deleted":false});

let doc = generate_platform_filter_document(Some(Desktop),true).expect("err");
fn test_deleted_filter() {
let doc = generate_platform_filter_document(Some(Desktop), false)
.expect("Err");
assert_eq!(doc, doc! {"platform": "desktop","deleted":false});

let doc = generate_platform_filter_document(Some(Desktop), true)
.expect("err");
assert_eq!(doc, doc! {"platform": "desktop"})

}

#[tokio::test]
async fn test_retrieve_version() {
connect_db_with_migrate::<DatabaseManage, _, _>(
Expand Down

0 comments on commit 2f3accc

Please sign in to comment.