26 lines
809 B
C++
26 lines
809 B
C++
#include <QtTest>
|
|
#include "../src/middleware/orchestrator.h"
|
|
|
|
class SnapshotTest : public QObject {
|
|
Q_OBJECT
|
|
private slots:
|
|
void round_trip() {
|
|
// Ensure no PG_DSN is required; Orchestrator maintains a shared in-memory DAL per instance
|
|
Orchestrator orch;
|
|
const QString ns = QStringLiteral("tests");
|
|
const QString key = QStringLiteral("session:last");
|
|
|
|
QJsonObject payload{{"a", 1}, {"b", QStringLiteral("x")}};
|
|
QVERIFY2(orch.saveSnapshot(ns, key, payload), "saveSnapshot should succeed");
|
|
|
|
auto loaded = orch.loadSnapshot(ns, key);
|
|
QVERIFY2(loaded.has_value(), "loadSnapshot should return value");
|
|
QCOMPARE(loaded->value("a").toInt(), 1);
|
|
QCOMPARE(loaded->value("b").toString(), QStringLiteral("x"));
|
|
}
|
|
};
|
|
|
|
QTEST_MAIN(SnapshotTest)
|
|
#include "test_snapshot.moc"
|
|
|