19 行
503 B
C++
19 行
503 B
C++
#include <catch2/catch_test_macros.hpp>
|
|
|
|
#include "csp/db/sqlite_db.h"
|
|
#include "csp/services/kb_service.h"
|
|
|
|
TEST_CASE("kb service list/detail") {
|
|
auto db = csp::db::SqliteDb::OpenMemory();
|
|
csp::db::ApplyMigrations(db);
|
|
csp::db::SeedDemoData(db);
|
|
|
|
csp::services::KbService svc(db);
|
|
const auto rows = svc.ListArticles();
|
|
REQUIRE(rows.size() >= 2);
|
|
|
|
const auto detail = svc.GetBySlug(rows.front().slug);
|
|
REQUIRE(detail.has_value());
|
|
REQUIRE(detail->article.slug == rows.front().slug);
|
|
}
|