зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1504182 [wpt PR 13860] - Remove tests for supportedTypes from payment handler, a=testonly
Automatic update from web-platform-testsRemove tests for supportedTypes from payment handler (#13860) -- wpt-commits: 5d4871b4b8b5f5c489ddab276d68e952a5babb85 wpt-pr: 13860
This commit is contained in:
Родитель
6d3a5b12b7
Коммит
702069faba
|
@ -33,29 +33,6 @@ self.addEventListener('paymentrequest', event => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const supportedTypes = methodData.data.supportedTypes;
|
|
||||||
if (!supportedTypes) {
|
|
||||||
const msg = 'Expected supported types in payment method specific data';
|
|
||||||
event.respondWith(Promise.reject(new Error(msg)));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (supportedTypes.length !== 1) {
|
|
||||||
const msg = `Expected one supported type, but got ${
|
|
||||||
supportedTypes.length
|
|
||||||
} instead`;
|
|
||||||
event.respondWith(Promise.reject(new Error(msg)));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const supportedType = supportedTypes[0];
|
|
||||||
const expectedSupportedType = 'prepaid';
|
|
||||||
if (supportedType !== expectedSupportedType) {
|
|
||||||
const msg = `Expected supported type "${expectedSupportedType}", but got "${supportedType}"`;
|
|
||||||
event.respondWith(Promise.reject(new Error(msg)));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (methodData.displayItems) {
|
if (methodData.displayItems) {
|
||||||
const msg = 'Expected no display items';
|
const msg = 'Expected no display items';
|
||||||
event.respondWith(Promise.reject(new Error(msg)));
|
event.respondWith(Promise.reject(new Error(msg)));
|
||||||
|
|
|
@ -264,14 +264,12 @@ promise_test(async t => {
|
||||||
promise_test(async t => {
|
promise_test(async t => {
|
||||||
const methodName = 'basic-card';
|
const methodName = 'basic-card';
|
||||||
await registerApp(methodName);
|
await registerApp(methodName);
|
||||||
const cardType = 'prepaid';
|
|
||||||
const cardNetwork = 'mir';
|
const cardNetwork = 'mir';
|
||||||
const request = new PaymentRequest(
|
const request = new PaymentRequest(
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
supportedMethods: methodName,
|
supportedMethods: methodName,
|
||||||
data: {
|
data: {
|
||||||
supportedTypes: [cardType],
|
|
||||||
supportedNetworks: [cardNetwork],
|
supportedNetworks: [cardNetwork],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -305,14 +303,12 @@ promise_test(async t => {
|
||||||
|
|
||||||
promise_test(async t => {
|
promise_test(async t => {
|
||||||
const methodName = 'basic-card';
|
const methodName = 'basic-card';
|
||||||
const cardType = 'prepaid';
|
|
||||||
const cardNetwork = 'mir';
|
const cardNetwork = 'mir';
|
||||||
const registration = await registerApp(methodName);
|
const registration = await registerApp(methodName);
|
||||||
await registration.paymentManager.instruments.set(instrumentKey, {
|
await registration.paymentManager.instruments.set(instrumentKey, {
|
||||||
name: 'Test Payment Method',
|
name: 'Test Payment Method',
|
||||||
method: methodName,
|
method: methodName,
|
||||||
capabilities: {
|
capabilities: {
|
||||||
supportedTypes: [cardType],
|
|
||||||
supportedNetworks: [cardNetwork],
|
supportedNetworks: [cardNetwork],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -321,7 +317,6 @@ promise_test(async t => {
|
||||||
{
|
{
|
||||||
supportedMethods: methodName,
|
supportedMethods: methodName,
|
||||||
data: {
|
data: {
|
||||||
supportedTypes: [cardType],
|
|
||||||
supportedNetworks: [cardNetwork],
|
supportedNetworks: [cardNetwork],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -355,14 +350,12 @@ promise_test(async t => {
|
||||||
|
|
||||||
promise_test(async t => {
|
promise_test(async t => {
|
||||||
const methodName = 'basic-card';
|
const methodName = 'basic-card';
|
||||||
const cardType = 'prepaid';
|
|
||||||
const cardNetwork = 'mir';
|
const cardNetwork = 'mir';
|
||||||
const registration = await registerApp(methodName);
|
const registration = await registerApp(methodName);
|
||||||
await registration.paymentManager.instruments.set(instrumentKey, {
|
await registration.paymentManager.instruments.set(instrumentKey, {
|
||||||
name: 'Test Payment Method',
|
name: 'Test Payment Method',
|
||||||
method: methodName,
|
method: methodName,
|
||||||
capabilities: {
|
capabilities: {
|
||||||
supportedTypes: [cardType],
|
|
||||||
supportedNetworks: [cardNetwork],
|
supportedNetworks: [cardNetwork],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -77,7 +77,7 @@ function runTests(registration) {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
method: 'basic-card',
|
method: 'basic-card',
|
||||||
capabilities: {supportedNetworks: ['mir'], supportedTypes: ['prepaid']},
|
capabilities: {supportedNetworks: ['mir']},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
const result = await registration.paymentManager.instruments.get(
|
const result = await registration.paymentManager.instruments.get(
|
||||||
|
@ -104,7 +104,7 @@ function runTests(registration) {
|
||||||
{src: '/images/green-16x16.png', sizes: '16x16', type: 'image/png'},
|
{src: '/images/green-16x16.png', sizes: '16x16', type: 'image/png'},
|
||||||
],
|
],
|
||||||
method: 'basic-card',
|
method: 'basic-card',
|
||||||
capabilities: {supportedNetworks: ['mir'], supportedTypes: ['prepaid']},
|
capabilities: {supportedNetworks: ['mir']},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
let result = await registration.paymentManager.instruments.get(
|
let result = await registration.paymentManager.instruments.get(
|
||||||
|
@ -120,7 +120,6 @@ function runTests(registration) {
|
||||||
assert_equals(result.icons[0].type, 'image/png');
|
assert_equals(result.icons[0].type, 'image/png');
|
||||||
assert_equals(result.method, 'basic-card');
|
assert_equals(result.method, 'basic-card');
|
||||||
assert_array_equals(result.capabilities.supportedNetworks, ['mir']);
|
assert_array_equals(result.capabilities.supportedNetworks, ['mir']);
|
||||||
assert_array_equals(result.capabilities.supportedTypes, ['prepaid']);
|
|
||||||
await registration.paymentManager.instruments.set(
|
await registration.paymentManager.instruments.set(
|
||||||
'existing-instrument-key',
|
'existing-instrument-key',
|
||||||
{
|
{
|
||||||
|
@ -133,7 +132,7 @@ function runTests(registration) {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
method: 'basic-card',
|
method: 'basic-card',
|
||||||
capabilities: {supportedNetworks: ['visa'], supportedTypes: ['credit']},
|
capabilities: {supportedNetworks: ['visa']},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
result = await registration.paymentManager.instruments.get(
|
result = await registration.paymentManager.instruments.get(
|
||||||
|
@ -149,7 +148,6 @@ function runTests(registration) {
|
||||||
assert_equals(result.icons[0].type, 'image/png');
|
assert_equals(result.icons[0].type, 'image/png');
|
||||||
assert_equals(result.method, 'basic-card');
|
assert_equals(result.method, 'basic-card');
|
||||||
assert_array_equals(result.capabilities.supportedNetworks, ['visa']);
|
assert_array_equals(result.capabilities.supportedNetworks, ['visa']);
|
||||||
assert_array_equals(result.capabilities.supportedTypes, ['credit']);
|
|
||||||
}, 'Resetting an existing instrument updates the instrument');
|
}, 'Resetting an existing instrument updates the instrument');
|
||||||
|
|
||||||
promise_test(async t => {
|
promise_test(async t => {
|
||||||
|
@ -166,7 +164,7 @@ function runTests(registration) {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
method: 'basic-card',
|
method: 'basic-card',
|
||||||
capabilities: {supportedNetworks: ['mir'], supportedTypes: ['prepaid']},
|
capabilities: {supportedNetworks: ['mir']},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
await registration.paymentManager.instruments.clear();
|
await registration.paymentManager.instruments.clear();
|
||||||
|
|
|
@ -16,7 +16,7 @@ async function setInstrumentsAndRunTests(registration) {
|
||||||
{src: '/images/rgrg-256x256.png', sizes: '256x256', type: 'image/png'},
|
{src: '/images/rgrg-256x256.png', sizes: '256x256', type: 'image/png'},
|
||||||
],
|
],
|
||||||
method: 'basic-card',
|
method: 'basic-card',
|
||||||
capabilities: {supportedNetworks: ['mir'], supportedTypes: ['prepaid']},
|
capabilities: {supportedNetworks: ['mir']},
|
||||||
});
|
});
|
||||||
runTests();
|
runTests();
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ function runTests() {
|
||||||
promise_test(async t => {
|
promise_test(async t => {
|
||||||
const response = await new PaymentRequest(
|
const response = await new PaymentRequest(
|
||||||
[
|
[
|
||||||
{supportedMethods: 'basic-card', data: {supportedTypes: ['prepaid']}},
|
{supportedMethods: 'basic-card', data: {}},
|
||||||
{supportedMethods: 'interledger', data: {supportedNetworks: ['mir']}},
|
{supportedMethods: 'interledger', data: {supportedNetworks: ['mir']}},
|
||||||
],
|
],
|
||||||
{
|
{
|
||||||
|
@ -60,7 +60,7 @@ function runTests() {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
supportedMethods: 'interledger',
|
supportedMethods: 'interledger',
|
||||||
data: {supportedTypes: ['prepaid']},
|
data: {},
|
||||||
total: {
|
total: {
|
||||||
label: 'Prepaid total',
|
label: 'Prepaid total',
|
||||||
amount: {currency: 'USD', value: '0.0097'},
|
amount: {currency: 'USD', value: '0.0097'},
|
||||||
|
|
Загрузка…
Ссылка в новой задаче