Skip to content

Commit d5a2995

Browse files
committed
Fix some ut
1 parent 42b7ff2 commit d5a2995

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

tests/database_tests.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,15 +248,18 @@ fn db_encryption_key() {
248248
#[test]
249249
fn add_listener() {
250250
utils::with_db(|db| {
251+
let mut default_collection = default_collection(db);
252+
251253
let (sender, receiver) = std::sync::mpsc::channel();
252-
let listener_token = default_collection(db).add_listener(Box::new(move |_, doc_ids| {
254+
let listener_token = default_collection.add_listener(Box::new(move |_, doc_ids| {
255+
println!("\nDoc ids: {:?}\n", doc_ids);
253256
if doc_ids.first().unwrap() == "document" {
254257
sender.send(true).unwrap();
255258
}
256259
}));
257260

258261
let mut doc = Document::new_with_id("document");
259-
default_collection(db)
262+
default_collection
260263
.save_document_with_concurency_control(&mut doc, ConcurrencyControl::LastWriteWins)
261264
.unwrap();
262265

@@ -276,14 +279,15 @@ fn buffer_notifications() {
276279
utils::set_static(&BUFFER_NOTIFICATIONS, true);
277280
});
278281

279-
let listener_token = default_collection(db).add_listener(Box::new(move |_, doc_ids| {
282+
let mut default_collection = default_collection(db);
283+
let listener_token = default_collection.add_listener(Box::new(move |_, doc_ids| {
280284
if doc_ids.first().unwrap() == "document" {
281285
utils::set_static(&DOCUMENT_DETECTED, true);
282286
}
283287
}));
284288

285289
let mut doc = Document::new_with_id("document");
286-
default_collection(db)
290+
default_collection
287291
.save_document_with_concurency_control(&mut doc, ConcurrencyControl::LastWriteWins)
288292
.unwrap();
289293

tests/replicator_tests.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ use std::{time::Duration, thread};
2626

2727
pub mod utils;
2828

29-
use crate::utils::default_collection;
30-
3129
//////// TESTS:
3230

3331
#[test]

0 commit comments

Comments
 (0)