Skip to content

Commit d32037c

Browse files
Another test for complex constraints on metadata
1 parent e567139 commit d32037c

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

test/metadata-test.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,3 +195,34 @@ TEST(Metadata, mandatoryMetadataAndSimpleChecksAreRunUnconditionally)
195195
})
196196
);
197197
}
198+
199+
TEST(Metadata, complexChecksAreRunOnlyIfMandatoryMetadataRequirementsAreMet)
200+
{
201+
zim::Metadata m;
202+
203+
m.set("Description", "Blablabla");
204+
m.set("LongDescription", "Blabla");
205+
m.set("Date", "2020-20-20");
206+
m.set("Creator", "TED");
207+
m.set("Name", "TED_bodylanguage");
208+
//m.set("Title", "");
209+
m.set("Publisher", "Kiwix");
210+
m.set("Language", "bod,yla,ngu,age");
211+
m.set("Illustration_48x48@1", fakePNG());
212+
213+
ASSERT_FALSE(m.valid());
214+
ASSERT_EQ(m.check(),
215+
zim::Metadata::Errors({
216+
"Missing mandatory metadata: Title",
217+
})
218+
);
219+
220+
m.set("Title", "Blabluba");
221+
222+
ASSERT_FALSE(m.valid());
223+
ASSERT_EQ(m.check(),
224+
zim::Metadata::Errors({
225+
"LongDescription shouldn't be shorter than Description"
226+
})
227+
);
228+
}

0 commit comments

Comments
 (0)