#include #include #include "storage/ProjectRepository.h" #include "storage/JsonValidator.h" #include "storage/OfflineBundle.h" #include #include "adapters/AdInventory.h" #include "workflows/IdentityMapper.h" #include "app/AppController.h" #include #include #include #include using namespace ald; class StorageTests:public QObject { Q_OBJECT private slots: void initTestCase(){Q_INIT_RESOURCE(resources);} void logWithAbsentOptionalContext(){QTemporaryDir dir;ProjectRepository r;r.open(dir.path());r.event({}, {}, "session.open", "INFO", "app", "Открыт проект");const auto events=r.events();QCOMPARE(events.size(),1);const auto event=events[0].toObject();QCOMPARE(event.value("message_ru").toString(),QString("Открыт проект"));QVERIFY(event.value("run_id").isString());QCOMPARE(event.value("redacted_detail").toString(),QString(""));} void checklistSurvivesReopenAndExportsSchema(){ QTemporaryDir dir;const auto project=dir.path()+"/project",output=dir.path()+"/checklist.json"; { AppController c;c.open(project,true); c.recordHuman({{"item_id","namespace"},{"host_id","corp.local"},{"checked_by","Тестовый оператор"},{"result","PASS"},{"note","Синтетическая проверка "}},"old");auto rows=r.observations("new");QCOMPARE(rows.size(),1);QCOMPARE(rows[0].toObject().value("result").toString(),QString("STALE"));QCOMPARE(rows[0].toObject().value("original_result").toString(),QString("PASS"));r.exportChecklist(dir.path()+"/out.html",QJsonArray{QJsonObject{{"id","login"},{"title_ru","Проверить