Throw when inAppPurchase is used on unsupported platforms

This commit is contained in:
Cheng Zhao 2018-01-10 18:53:55 +09:00
Родитель a883d3d50d
Коммит bd271cffb9
2 изменённых файлов: 6 добавлений и 1 удалений

Просмотреть файл

@ -1,5 +1,9 @@
'use strict'
if (process.platform !== 'darwin') {
throw new Error('The inAppPurchase module can only be used on macOS')
}
const {EventEmitter} = require('events')
const {inAppPurchase, InAppPurchase} = process.atomBinding('in_app_purchase')

Просмотреть файл

@ -3,11 +3,12 @@
const assert = require('assert')
const {remote} = require('electron')
const {inAppPurchase} = remote
describe('inAppPurchase module', () => {
if (process.platform !== 'darwin') return
const {inAppPurchase} = remote
it('canMakePayments() does not throw', () => {
inAppPurchase.canMakePayments()
})