Bug 38503: Deal with types that can be "null"

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Jonathan Druart 2024-11-21 15:00:26 +01:00 committed by Katrin Fischer
parent 34f6663374
commit 3bc9bd8b62
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
2 changed files with 4 additions and 0 deletions

View File

@ -12,6 +12,7 @@ describe("Generate Random Patron", () => {
values: { surname: "test_surname" },
}).then(mockPatron => {
expect(mockPatron.surname).to.equal("test_surname");
expect(mockPatron.overdues_count).to.be.a("number");
});
});
});

View File

@ -10,6 +10,9 @@ const objects = {
},
};
const generateMockData = type => {
if (Array.isArray(type)) {
type = type.filter(t => t != '"null"')[0];
}
switch (type) {
case "string":
return faker.lorem.words(3);