Skip to content

Commit

Permalink
Another test for complex constraints on metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
veloman-yunkan committed Apr 26, 2023
1 parent 47ac096 commit 0f79d9d
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions test/metadata-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,34 @@ TEST(Metadata, mandatoryMetadataAndSimpleChecksAreRunUnconditionally)
})
);
}

TEST(Metadata, complexChecksAreRunOnlyIfMandatoryMetadataRequirementsAreMet)
{
zim::Metadata m;

m.set("Description", "Blablabla");
m.set("LongDescription", "Blabla");
m.set("Date", "2020-20-20");
m.set("Creator", "TED");
m.set("Name", "TED_bodylanguage");
//m.set("Title", "");
m.set("Publisher", "Kiwix");
m.set("Language", "bod,yla,ngu,age");
m.set("Illustration_48x48@1", fakePNG());

ASSERT_FALSE(m.valid());
ASSERT_EQ(m.check(),
zim::Metadata::Errors({
"Missing mandatory metadata: Title",
})
);

m.set("Title", "Blabluba");

ASSERT_FALSE(m.valid());
ASSERT_EQ(m.check(),
zim::Metadata::Errors({
"LongDescription shouldn't be shorter than Description"
})
);
}

0 comments on commit 0f79d9d

Please sign in to comment.