зеркало из https://github.com/electron/electron.git
test: move inAppPurchase spec (#19232)
This commit is contained in:
Родитель
8a57fe5466
Коммит
1ff2704445
|
@ -1,20 +1,11 @@
|
|||
'use strict'
|
||||
|
||||
const chai = require('chai')
|
||||
const dirtyChai = require('dirty-chai')
|
||||
|
||||
const { expect } = chai
|
||||
chai.use(dirtyChai)
|
||||
|
||||
const { remote } = require('electron')
|
||||
import { expect } from 'chai'
|
||||
import { inAppPurchase } from 'electron'
|
||||
|
||||
describe('inAppPurchase module', function () {
|
||||
if (process.platform !== 'darwin') return
|
||||
|
||||
this.timeout(3 * 60 * 1000)
|
||||
|
||||
const { inAppPurchase } = remote
|
||||
|
||||
it('canMakePayments() does not throw', () => {
|
||||
expect(() => {
|
||||
inAppPurchase.canMakePayments()
|
||||
|
@ -34,8 +25,7 @@ describe('inAppPurchase module', function () {
|
|||
})
|
||||
|
||||
it('getReceiptURL() returns receipt URL', () => {
|
||||
const correctUrlEnd = inAppPurchase.getReceiptURL().endsWith('_MASReceipt/receipt')
|
||||
expect(correctUrlEnd).to.be.true()
|
||||
expect(inAppPurchase.getReceiptURL()).to.match(/_MASReceipt\/receipt$/)
|
||||
})
|
||||
|
||||
// The following three tests are disabled because they hit Apple servers, and
|
||||
|
@ -45,12 +35,12 @@ describe('inAppPurchase module', function () {
|
|||
// without relying on a remote service.
|
||||
xit('purchaseProduct() fails when buying invalid product', async () => {
|
||||
const success = await inAppPurchase.purchaseProduct('non-exist', 1)
|
||||
expect(success).to.be.false()
|
||||
expect(success).to.be.false('failed to purchase non-existent product')
|
||||
})
|
||||
|
||||
xit('purchaseProduct() accepts optional arguments', async () => {
|
||||
const success = await inAppPurchase.purchaseProduct('non-exist')
|
||||
expect(success).to.be.false()
|
||||
expect(success).to.be.false('failed to purchase non-existent product')
|
||||
})
|
||||
|
||||
xit('getProducts() returns an empty list when getting invalid product', async () => {
|
Загрузка…
Ссылка в новой задаче