spec: Simple tests for inAppPurchase module
This commit is contained in:
parent
5f1c76c688
commit
bdeb979d41
1 changed files with 25 additions and 0 deletions
25
spec/api-in-app-purchase-spec.js
Normal file
25
spec/api-in-app-purchase-spec.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
'use strict'
|
||||
|
||||
const assert = require('assert')
|
||||
|
||||
const {remote} = require('electron')
|
||||
const {inAppPurchase} = remote
|
||||
|
||||
describe('inAppPurchase module', () => {
|
||||
if (process.platform !== 'darwin') return
|
||||
|
||||
it('canMakePayments() does not throw', () => {
|
||||
inAppPurchase.canMakePayments()
|
||||
})
|
||||
|
||||
it('getReceiptURL() returns receipt URL', () => {
|
||||
assert.ok(inAppPurchase.getReceiptURL().endsWith('_MASReceipt/receipt'))
|
||||
})
|
||||
|
||||
it('purchaseProduct() fails when buying invalid product', (done) => {
|
||||
inAppPurchase.purchaseProduct('non-exist', 1, (success) => {
|
||||
assert.ok(!success)
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
Loading…
Add table
Reference in a new issue