test: move inAppPurchase spec (#19232)
This commit is contained in:
parent
8a57fe5466
commit
1ff2704445
1 changed files with 5 additions and 15 deletions
|
@ -1,20 +1,11 @@
|
||||||
'use strict'
|
import { expect } from 'chai'
|
||||||
|
import { inAppPurchase } from 'electron'
|
||||||
const chai = require('chai')
|
|
||||||
const dirtyChai = require('dirty-chai')
|
|
||||||
|
|
||||||
const { expect } = chai
|
|
||||||
chai.use(dirtyChai)
|
|
||||||
|
|
||||||
const { remote } = require('electron')
|
|
||||||
|
|
||||||
describe('inAppPurchase module', function () {
|
describe('inAppPurchase module', function () {
|
||||||
if (process.platform !== 'darwin') return
|
if (process.platform !== 'darwin') return
|
||||||
|
|
||||||
this.timeout(3 * 60 * 1000)
|
this.timeout(3 * 60 * 1000)
|
||||||
|
|
||||||
const { inAppPurchase } = remote
|
|
||||||
|
|
||||||
it('canMakePayments() does not throw', () => {
|
it('canMakePayments() does not throw', () => {
|
||||||
expect(() => {
|
expect(() => {
|
||||||
inAppPurchase.canMakePayments()
|
inAppPurchase.canMakePayments()
|
||||||
|
@ -34,8 +25,7 @@ describe('inAppPurchase module', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('getReceiptURL() returns receipt URL', () => {
|
it('getReceiptURL() returns receipt URL', () => {
|
||||||
const correctUrlEnd = inAppPurchase.getReceiptURL().endsWith('_MASReceipt/receipt')
|
expect(inAppPurchase.getReceiptURL()).to.match(/_MASReceipt\/receipt$/)
|
||||||
expect(correctUrlEnd).to.be.true()
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// The following three tests are disabled because they hit Apple servers, and
|
// 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.
|
// without relying on a remote service.
|
||||||
xit('purchaseProduct() fails when buying invalid product', async () => {
|
xit('purchaseProduct() fails when buying invalid product', async () => {
|
||||||
const success = await inAppPurchase.purchaseProduct('non-exist', 1)
|
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 () => {
|
xit('purchaseProduct() accepts optional arguments', async () => {
|
||||||
const success = await inAppPurchase.purchaseProduct('non-exist')
|
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 () => {
|
xit('getProducts() returns an empty list when getting invalid product', async () => {
|
Loading…
Reference in a new issue