Added falsy fields to be automatically excluded with warn being emitted

This commit is contained in:
Alexander Cerutti
2022-02-22 00:04:07 +01:00
parent 7ccbdf9f80
commit 27511806a8
2 changed files with 20 additions and 1 deletions

View File

@@ -68,6 +68,18 @@ describe("FieldsArray", () => {
expect(fa.length).toBe(1);
});
it("should log a warning if input items contain undefined and, then, ignore it", () => {
console.warn = jasmine.createSpy("log");
fa.push(undefined, { key: "t1", value: "v1" });
expect(console.warn).toHaveBeenCalledWith(
Messages.FIELDS.INVALID.replace("%s", "undefined"),
);
expect(fa.length).toBe(1);
});
});
describe("pop", () => {