Skip to content

Commit

Permalink
Add tests for Document{Name,Path}::collection_id
Browse files Browse the repository at this point in the history
  • Loading branch information
bouzuya committed Dec 20, 2023
1 parent d078d8c commit b7af41a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/lib.rs
Expand Up @@ -31,6 +31,10 @@ fn test_collection_id_document_id_and_parent() -> anyhow::Result<()> {
let document_name = collection_name
.parent()
.context("subcollection should have parent")?;
assert_eq!(
document_name.collection_id(),
&CollectionId::from_str("chatrooms")?
);
assert_eq!(
document_name.document_id(),
&DocumentId::from_str("chatroom1")?
Expand All @@ -42,6 +46,10 @@ fn test_collection_id_document_id_and_parent() -> anyhow::Result<()> {
);

let document_path = DocumentPath::from_str("chatrooms/chatroom1/messages/message1")?;
assert_eq!(
document_path.collection_id(),
&CollectionId::from_str("messages")?
);
assert_eq!(
document_path.document_id(),
&DocumentId::from_str("message1")?
Expand All @@ -54,6 +62,10 @@ fn test_collection_id_document_id_and_parent() -> anyhow::Result<()> {
let document_path = collection_path
.parent()
.context("subcollection should have parent")?;
assert_eq!(
document_path.collection_id(),
&CollectionId::from_str("chatrooms")?
);
assert_eq!(
document_path.document_id(),
&DocumentId::from_str("chatroom1")?
Expand Down

0 comments on commit b7af41a

Please sign in to comment.