From 72648695abafcd48c31700d29dab0f016f5d660e Mon Sep 17 00:00:00 2001 From: Max batleforc Date: Sat, 10 Aug 2024 14:57:40 +0200 Subject: [PATCH] feat: test ToSChema --- libs/markdown_struct/src/blog_timeline.rs | 6 ++++++ libs/markdown_struct/src/content_struct.rs | 8 ++++++++ libs/markdown_struct/src/doc_header.rs | 11 +++++++++++ package.json | 3 ++- 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/libs/markdown_struct/src/blog_timeline.rs b/libs/markdown_struct/src/blog_timeline.rs index 7781e2e..3930eb4 100644 --- a/libs/markdown_struct/src/blog_timeline.rs +++ b/libs/markdown_struct/src/blog_timeline.rs @@ -219,4 +219,10 @@ mod tests { .unwrap(); assert_eq!(short_page.name, "test_page"); } + + #[test] + fn test_blog_timeline_to_schema() { + let schema = BlogTimeline::schema(); + assert_eq!(schema.0, "BlogTimeline"); + } } diff --git a/libs/markdown_struct/src/content_struct.rs b/libs/markdown_struct/src/content_struct.rs index 7f09b57..0b3df92 100644 --- a/libs/markdown_struct/src/content_struct.rs +++ b/libs/markdown_struct/src/content_struct.rs @@ -130,4 +130,12 @@ mod tests { let deserialized: PageShort = serde_json::from_str(&serialized).unwrap(); assert_eq!(page_short, deserialized); } + + #[test] + fn test_page_to_schema() { + let schema_page = Page::schema(); + let schema_page_short = PageShort::schema(); + assert_eq!(schema_page.0, "Page".to_string()); + assert_eq!(schema_page_short.0, "PageShort".to_string()); + } } diff --git a/libs/markdown_struct/src/doc_header.rs b/libs/markdown_struct/src/doc_header.rs index d28e87a..2c15fa1 100644 --- a/libs/markdown_struct/src/doc_header.rs +++ b/libs/markdown_struct/src/doc_header.rs @@ -273,4 +273,15 @@ THIS IS A TEST } ); } + + #[test] + fn test_header_schema() { + let schema_header_spec = DocHeaderSpec::schema(); + let schema_header_link = DocHeaderLink::schema(); + let schema_header = DocHeader::schema(); + + assert_eq!(schema_header_spec.0, "DocHeaderSpec"); + assert_eq!(schema_header_link.0, "DocHeaderLink"); + assert_eq!(schema_header.0, "DocHeader"); + } } diff --git a/package.json b/package.json index d29dd9d..c575c48 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,8 @@ "version": "0.0.0", "license": "MIT", "scripts": { - "rust:test":"cargo llvm-cov --open --ignore-filename-regex 'init'" + "rust:test":"cargo llvm-cov --open --ignore-filename-regex 'init'", + "rust:start": "podman compose up -d && cargo run" }, "private": true, "dependencies": {