Updated specs

This commit is contained in:
Alexander Cerutti
2022-01-15 19:41:52 +01:00
parent 931954d1b9
commit 267ca6baff

View File

@@ -26,12 +26,11 @@ describe("PKPass", () => {
beforeEach(() => { beforeEach(() => {
pass = new PKPass({}); pass = new PKPass({});
console.warn = jasmine.createSpy("warn_logging");
}); });
describe("constructor", () => { describe("constructor", () => {
it("should warn about a non-object buffer parameter", () => { it("should warn about a non-object buffer parameter", () => {
console.warn = jasmine.createSpy("warn");
pass = new PKPass(undefined, baseCerts); pass = new PKPass(undefined, baseCerts);
expect(console.warn).toHaveBeenCalledWith( expect(console.warn).toHaveBeenCalledWith(
@@ -343,18 +342,25 @@ describe("PKPass", () => {
}); });
it("should ignore objects and values that not comply with Schema.Barcodes", () => { it("should ignore objects and values that not comply with Schema.Barcodes", () => {
pass.setBarcodes( const setBarcodesArguments: Parameters<typeof pass["setBarcodes"]> =
// @ts-expect-error [
5, // @ts-expect-error
10, 5,
15, // @ts-expect-error
{ 10,
message: "28363516282", // @ts-expect-error
format: "PKBarcodeFormatPDF417", 15,
}, {
7, message: "28363516282",
1, format: "PKBarcodeFormatPDF417",
); },
// @ts-expect-error
7,
// @ts-expect-error
1,
];
pass.setBarcodes(...setBarcodesArguments);
expect(pass.props["barcodes"].length).toBe(1); expect(pass.props["barcodes"].length).toBe(1);
}); });
@@ -656,7 +662,6 @@ describe("PKPass", () => {
}); });
it("should warn developer if no translations have been passed", () => { it("should warn developer if no translations have been passed", () => {
console.warn = jasmine.createSpy("log");
// @ts-expect-error // @ts-expect-error
pass.localize("en"); pass.localize("en");
pass.localize("en", {}); pass.localize("en", {});
@@ -939,7 +944,6 @@ describe("PKPass", () => {
}); });
it("Should warn user if no icons have been added to bundle", () => { it("Should warn user if no icons have been added to bundle", () => {
console.warn = jasmine.createSpy("log");
pass[closePassSymbol](true); pass[closePassSymbol](true);
expect(console.warn).toHaveBeenCalledWith( expect(console.warn).toHaveBeenCalledWith(