Distinguish new career news from participant changes in entry checks (by Codex)
This commit is contained in:
1 parent
415ace1b8e
commit
b809a8de14
1 file changed
+17
@@ -283,6 +283,7 @@ void additional_managers(const Fixture &fixture) {
|
|||||||
}
|
}
|
||||||
void club_migration(const Fixture &fixture) {
|
void club_migration(const Fixture &fixture) {
|
||||||
DemoSource started(fixture.world), edited(fixture.world);
|
DemoSource started(fixture.world), edited(fixture.world);
|
||||||
|
const auto historical_news = edited.snapshot().state.at("news");
|
||||||
auto rows = Json::array({manager(1), manager(2)});
|
auto rows = Json::array({manager(1), manager(2)});
|
||||||
require(edited.apply({0, "managers", rows}).ok,
|
require(edited.apply({0, "managers", rows}).ok,
|
||||||
"Reference manager club switch failed");
|
"Reference manager club switch failed");
|
||||||
@@ -294,6 +295,22 @@ void club_migration(const Fixture &fixture) {
|
|||||||
reference["opening"] = "pending";
|
reference["opening"] = "pending";
|
||||||
reference["opening_created"] = false;
|
reference["opening_created"] = false;
|
||||||
reference["opening_flow"] = make_demo_opening(*fixture.world, reference, true);
|
reference["opening_flow"] = make_demo_opening(*fixture.world, reference, true);
|
||||||
|
require(reference.at("news") == historical_news,
|
||||||
|
"Changing participants rewrote historical news");
|
||||||
|
const auto &fresh_news = actual.at("news").at("items");
|
||||||
|
require(!fresh_news.empty() && actual.at("news") != historical_news &&
|
||||||
|
std::all_of(fresh_news.begin(), fresh_news.end(),
|
||||||
|
[&](const auto &item) {
|
||||||
|
return item.at("scope").at("id") ==
|
||||||
|
"club:entry-1" &&
|
||||||
|
item.at("owner").at("name") ==
|
||||||
|
actual.at("managers")[0].at("name");
|
||||||
|
}),
|
||||||
|
"New career did not bind fresh news to its confirmed first manager");
|
||||||
|
// A new career creates its own journal; changing participants preserves it.
|
||||||
|
// The remaining club-dependent presentation migrations must still agree.
|
||||||
|
reference.erase("news");
|
||||||
|
actual.erase("news");
|
||||||
require(
|
require(
|
||||||
reference == actual,
|
reference == actual,
|
||||||
"Start diverges from established club-change presentation migrations");
|
"Start diverges from established club-change presentation migrations");
|
||||||
|
|||||||
Reference in new issue
Block a user