Skip to content

Commit c251f8c

Browse files
committed
Remove placeholder and doc-only tests
Clean up test suites by removing placeholder/integration and documentation-only tests and commented examples that required a database. Deleted operator_tests and integration_tests from query_builder_tests.rs, removed self_referencing, linked_select and API-doc examples from seaorm2_features_tests.rs, and removed an empty/placeholder has_one test and related comments from unit_tests.rs. This reduces noise and keeps the repository's tests focused on compile-time/unit tests without DB-dependent stubs.
1 parent a018c86 commit c251f8c

3 files changed

Lines changed: 0 additions & 238 deletions

File tree

tests/query_builder_tests.rs

Lines changed: 0 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -95,141 +95,6 @@ mod query_builder_unit_tests {
9595
}
9696
}
9797

98-
#[cfg(test)]
99-
mod operator_tests {
100-
use tideorm::query::Operator;
101-
102-
#[test]
103-
fn test_all_operators_exist() {
104-
// Verify all operators can be constructed
105-
let _ = Operator::Eq;
106-
let _ = Operator::NotEq;
107-
let _ = Operator::Gt;
108-
let _ = Operator::Gte;
109-
let _ = Operator::Lt;
110-
let _ = Operator::Lte;
111-
let _ = Operator::Like;
112-
let _ = Operator::NotLike;
113-
let _ = Operator::In;
114-
let _ = Operator::NotIn;
115-
let _ = Operator::IsNull;
116-
let _ = Operator::IsNotNull;
117-
let _ = Operator::Between;
118-
// New subquery and raw operators
119-
let _ = Operator::SubqueryIn;
120-
let _ = Operator::SubqueryNotIn;
121-
let _ = Operator::Raw;
122-
}
123-
}
124-
125-
// ============================================================================
126-
// Integration tests (require database - marked with #[ignore] by default)
127-
// ============================================================================
128-
129-
/// Run these tests with: cargo test -- --ignored
130-
/// And with TEST_DATABASE_URL set
131-
#[cfg(test)]
132-
mod integration_tests {
133-
// These would be full integration tests with actual database
134-
// Leaving as placeholder structure for future implementation
135-
136-
/*
137-
Example test structure:
138-
139-
#[derive(Model, Clone, Debug, Serialize, Deserialize)]
140-
#[tideorm(table = "test_users")]
141-
struct TestUser {
142-
#[tideorm(primary_key, auto_increment)]
143-
pub id: i64,
144-
pub name: String,
145-
pub email: String,
146-
pub age: i32,
147-
pub active: bool,
148-
}
149-
150-
async fn setup_db() -> tideorm::Result<()> {
151-
let url = std::env::var("TEST_DATABASE_URL")
152-
.unwrap_or_else(|_| "sqlite::memory:".to_string());
153-
154-
TideConfig::init()
155-
.database(&url)
156-
.sync(true)
157-
.connect()
158-
.await?;
159-
160-
Ok(())
161-
}
162-
163-
#[tokio::test]
164-
#[ignore]
165-
async fn test_where_eq() {
166-
setup_db().await.unwrap();
167-
168-
// Create test data
169-
TestUser { id: 0, name: "John".into(), email: "john@test.com".into(), age: 25, active: true }
170-
.save().await.unwrap();
171-
TestUser { id: 0, name: "Jane".into(), email: "jane@test.com".into(), age: 30, active: false }
172-
.save().await.unwrap();
173-
174-
// Test WHERE eq
175-
let results = TestUser::query()
176-
.where_eq("name", "John")
177-
.get()
178-
.await
179-
.unwrap();
180-
181-
assert_eq!(results.len(), 1);
182-
assert_eq!(results[0].name, "John");
183-
}
184-
185-
#[tokio::test]
186-
#[ignore]
187-
async fn test_where_in() {
188-
setup_db().await.unwrap();
189-
190-
let results = TestUser::query()
191-
.where_in("name", vec!["John", "Jane"])
192-
.get()
193-
.await
194-
.unwrap();
195-
196-
assert_eq!(results.len(), 2);
197-
}
198-
199-
#[tokio::test]
200-
#[ignore]
201-
async fn test_count_with_conditions() {
202-
setup_db().await.unwrap();
203-
204-
let count = TestUser::query()
205-
.where_eq("active", true)
206-
.count()
207-
.await
208-
.unwrap();
209-
210-
assert_eq!(count, 1);
211-
}
212-
213-
#[tokio::test]
214-
#[ignore]
215-
async fn test_bulk_delete() {
216-
setup_db().await.unwrap();
217-
218-
let deleted = TestUser::query()
219-
.where_eq("active", false)
220-
.delete()
221-
.await
222-
.unwrap();
223-
224-
assert_eq!(deleted, 1);
225-
226-
// Verify deleted
227-
let count = TestUser::count().await.unwrap();
228-
assert_eq!(count, 1);
229-
}
230-
*/
231-
}
232-
23398
// ============================================================================
23499
// Database Pool Configuration Tests
235100
// ============================================================================

tests/seaorm2_features_tests.rs

Lines changed: 0 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -552,66 +552,13 @@ mod join_consolidation {
552552
}
553553
}
554554

555-
// =============================================================================
556-
// SELF-REFERENCING RELATIONS TESTS
557-
// =============================================================================
558-
559-
mod self_referencing {
560-
// Note: Full integration tests require database connection
561-
// These are compile-time and serialization tests
562-
563-
#[test]
564-
fn test_self_ref_serialization_placeholder() {
565-
// SelfRef and SelfRefMany types require Model trait implementations
566-
// which are generated by the derive macro. Integration tests with
567-
// actual database are needed for full testing.
568-
//
569-
// The types are tested via the library's unit tests in:
570-
// - src/relations.rs (SelfRef, SelfRefMany implementations)
571-
// - src/columns.rs (Column type unit tests)
572-
//
573-
// This test verifies the module compiles correctly.
574-
}
575-
576-
#[test]
577-
fn test_self_ref_api_documentation() {
578-
// API usage example (would require database):
579-
//
580-
// #[tideorm::model]
581-
// #[tideorm(table = "employees")]
582-
// struct Employee {
583-
// #[tideorm(primary_key)]
584-
// id: i64,
585-
// name: String,
586-
// manager_id: Option<i64>,
587-
//
588-
// #[tideorm(self_ref = "id", foreign_key = "manager_id")]
589-
// manager: SelfRef<Employee>,
590-
//
591-
// #[tideorm(self_ref_many = "id", foreign_key = "manager_id")]
592-
// reports: SelfRefMany<Employee>,
593-
// }
594-
//
595-
// let emp = Employee::find(5).await?;
596-
// let manager = emp.manager.load().await?;
597-
// let reports = emp.reports.load().await?;
598-
// let tree = emp.reports.load_tree(3).await?;
599-
}
600-
}
601-
602555
// =============================================================================
603556
// NESTED ACTIVE MODEL TESTS
604557
// =============================================================================
605558

606559
mod nested_save {
607-
// Note: Full integration tests require database connection
608-
// These are unit tests for the JSON manipulation logic
609-
610560
#[test]
611561
fn test_nested_save_builder_serialization() {
612-
// Test that serialization/deserialization works as expected
613-
// for the JSON manipulation used in NestedSave
614-
615562
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
616563
struct MockUser {
617564
id: i64,
@@ -644,8 +591,6 @@ mod nested_save {
644591

645592
#[test]
646593
fn test_foreign_key_update_logic() {
647-
// Test the JSON manipulation used by NestedSave
648-
649594
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, PartialEq)]
650595
struct Child {
651596
id: i64,
@@ -660,7 +605,6 @@ mod nested_save {
660605
};
661606
let mut json = serde_json::to_value(&child).unwrap();
662607

663-
// Simulate what save_with_one does
664608
if let serde_json::Value::Object(ref mut map) = json {
665609
map.insert("parent_id".to_string(), serde_json::json!(42));
666610
}
@@ -716,42 +660,4 @@ mod nested_save {
716660
assert_eq!(updated[1].title, "Second");
717661
assert_eq!(updated[2].title, "Third");
718662
}
719-
720-
#[test]
721-
fn test_nested_save_api_documentation() {
722-
// API usage example (would require database):
723-
//
724-
// let (user, profile) = user.save_with_one(profile, "user_id").await?;
725-
// let (user, posts) = user.save_with_many(posts, "user_id").await?;
726-
// let (user, profile) = user.update_with_one(profile).await?;
727-
// let deleted = user.delete_with_many(posts).await?;
728-
//
729-
// Or using the builder:
730-
// let (user, related) = NestedSaveBuilder::new(user)
731-
// .with_one(profile, "user_id")
732-
// .with_many(posts, "user_id")
733-
// .save()
734-
// .await?;
735-
}
736-
}
737-
738-
// =============================================================================
739-
// LINKED PARTIAL SELECT TESTS (Compile-time checks)
740-
// =============================================================================
741-
742-
mod linked_select {
743-
// These features are tested at compile time
744-
// Full integration tests require database connection
745-
746-
#[test]
747-
fn test_linked_select_types_exist() {
748-
// This is mainly a compile-time check that the methods exist
749-
// and have the correct signatures
750-
751-
// The actual usage would be:
752-
// User::query()
753-
// .select_with_linked::<Profile>(&["id", "name"], &["bio"], "user_id")
754-
// .get::<(User, String)>()
755-
// .await?;
756-
}
757663
}

tests/unit_tests.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4911,19 +4911,10 @@ mod relation_field_type_tests {
49114911
id: i64,
49124912
}
49134913

4914-
// Note: We can't actually test load() methods without a database,
4915-
// but we can test the struct creation and configuration
4916-
49174914
// =========================================================================
49184915
// HasOne TESTS
49194916
// =========================================================================
49204917

4921-
#[test]
4922-
fn test_has_one_new() {
4923-
// We can't easily create a HasOne without a Model, but we can test Default
4924-
// HasOne requires Model trait bound, so we test what we can
4925-
}
4926-
49274918
#[test]
49284919
fn test_has_one_default_has_none_cached() {
49294920
let relation = HasOne::<RelationFieldTestModel>::default();

0 commit comments

Comments
 (0)