Movd another PKPass.from message to messages

This commit is contained in:
Alexander Cerutti
2021-10-17 18:55:44 +02:00
parent 852ea53c77
commit f17daa0a45
3 changed files with 7 additions and 3 deletions

View File

@@ -960,12 +960,12 @@ describe("PKPass", () => {
PKPass.from(), PKPass.from(),
).toBeRejectedWithError( ).toBeRejectedWithError(
TypeError, TypeError,
"Cannot create PKPass from source: source is 'undefined'", Messages.FROM.MISSING_SOURCE.replace("%s", "undefined"),
); );
await expectAsync(PKPass.from(null)).toBeRejectedWithError( await expectAsync(PKPass.from(null)).toBeRejectedWithError(
TypeError, TypeError,
"Cannot create PKPass from source: source is 'null'", Messages.FROM.MISSING_SOURCE.replace("%s", "null"),
); );
}); });

View File

@@ -46,7 +46,7 @@ export default class PKPass extends Bundle {
if (!source) { if (!source) {
throw new TypeError( throw new TypeError(
`Cannot create PKPass from source: source is '${source}'`, formatMessage(Messages.FROM.MISSING_SOURCE, source),
); );
} }

View File

@@ -78,6 +78,10 @@ export const BUNDLE = {
CLOSED: "Cannot add file. Bundle is closed.", CLOSED: "Cannot add file. Bundle is closed.",
} as const; } as const;
export const FROM = {
MISSING_SOURCE: "Cannot create PKPass from source: source is '%s'",
} as const;
export const PACK = { export const PACK = {
INVALID: "Cannot pack passes. Only PKPass instances allowed", INVALID: "Cannot pack passes. Only PKPass instances allowed",
} as const; } as const;