blob: 2b79dec23319043a1c262fdeac43e8581412cdca [file]
This is a testharness.js-based test.
[FAIL] Empty instrument.details field throws exception.
assert_throws_js: function "() => {\n new PaymentRequest([{\n supportedMethods: 'secure-payment-confirmation',\n data: {\n credentialIds: [Uint8Array.from('x', c => c.charCodeAt(0))],\n challenge: Uint8Array.from('x', c => c.charCodeAt(0)),\n payeeOrigin: window.location.origin,\n timeout: 60000,\n instrument: {\n displayName: 'X',\n icon: 'https://example.test/icon.png',\n // Details can be omitted, but if present cannot be empty.\n details: '',\n },\n rpId: 'relying-party.example',\n },\n }], details);\n }" did not throw
[FAIL] Empty url field in a PaymentEntityLogo throws exception.
assert_throws_js: function "() => {\n new PaymentRequest([{\n supportedMethods: 'secure-payment-confirmation',\n data: {\n credentialIds: [Uint8Array.from('x', c => c.charCodeAt(0))],\n challenge: Uint8Array.from('x', c => c.charCodeAt(0)),\n payeeOrigin: window.location.origin,\n timeout: 60000,\n instrument: {\n displayName: 'X',\n icon: 'https://example.test/icon.png',\n },\n rpId: 'relying-party.example',\n paymentEntitiesLogos: [{\n url: '',\n label: 'Payment Entity Label',\n }],\n },\n }], details);\n }" did not throw
[FAIL] Invalid url field in a PaymentEntityLogo throws exception.
assert_throws_js: function "() => {\n new PaymentRequest([{\n supportedMethods: 'secure-payment-confirmation',\n data: {\n credentialIds: [Uint8Array.from('x', c => c.charCodeAt(0))],\n challenge: Uint8Array.from('x', c => c.charCodeAt(0)),\n payeeOrigin: window.location.origin,\n timeout: 60000,\n instrument: {\n displayName: 'X',\n icon: 'https://example.test/icon.png',\n },\n rpId: 'relying-party.example',\n paymentEntitiesLogos: [{\n url: 'thisisnotaurl',\n label: 'Payment Entity Label',\n }],\n },\n }], details);\n }" did not throw
[FAIL] Empty logo field in a PaymentEntityLogo throws exception.
assert_throws_js: function "() => {\n new PaymentRequest([{\n supportedMethods: 'secure-payment-confirmation',\n data: {\n credentialIds: [Uint8Array.from('x', c => c.charCodeAt(0))],\n challenge: Uint8Array.from('x', c => c.charCodeAt(0)),\n payeeOrigin: window.location.origin,\n timeout: 60000,\n instrument: {\n displayName: 'X',\n icon: 'https://example.test/icon.png',\n },\n rpId: 'relying-party.example',\n paymentEntitiesLogos: [{\n url: 'https://example.test/logo.png',\n label: '',\n }],\n },\n }], details);\n }" did not throw
Harness: the test ran to completion.