fix(snjs): factory timeout to propagate subscription purchase
This commit is contained in:
@@ -52,7 +52,7 @@ describe('files', function () {
|
|||||||
billingFrequency: 12,
|
billingFrequency: 12,
|
||||||
payAmount: 59.00
|
payAmount: 59.00
|
||||||
})
|
})
|
||||||
await Factory.sleep(1)
|
await Factory.sleep(2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,6 +65,7 @@ describe('files', function () {
|
|||||||
await setup({ fakeCrypto: true, subscription: true })
|
await setup({ fakeCrypto: true, subscription: true })
|
||||||
const remoteIdentifier = Utils.generateUuid()
|
const remoteIdentifier = Utils.generateUuid()
|
||||||
const token = await application.apiService.createFileValetToken(remoteIdentifier, 'write')
|
const token = await application.apiService.createFileValetToken(remoteIdentifier, 'write')
|
||||||
|
console.log(token)
|
||||||
|
|
||||||
expect(token.length).to.be.above(0)
|
expect(token.length).to.be.above(0)
|
||||||
})
|
})
|
||||||
@@ -97,7 +98,7 @@ describe('files', function () {
|
|||||||
payAmount: 59.00
|
payAmount: 59.00
|
||||||
})
|
})
|
||||||
|
|
||||||
await Factory.sleep(1)
|
await Factory.sleep(2)
|
||||||
|
|
||||||
const remoteIdentifier = Utils.generateUuid()
|
const remoteIdentifier = Utils.generateUuid()
|
||||||
const tokenOrError = await application.apiService.createFileValetToken(remoteIdentifier, 'write')
|
const tokenOrError = await application.apiService.createFileValetToken(remoteIdentifier, 'write')
|
||||||
@@ -163,10 +164,4 @@ describe('files', function () {
|
|||||||
|
|
||||||
expect(downloadError).to.be.ok
|
expect(downloadError).to.be.ok
|
||||||
})
|
})
|
||||||
|
|
||||||
it.skip('should cancel file download', async function () {
|
|
||||||
await setup({ fakeCrypto: false, subscription: true })
|
|
||||||
|
|
||||||
// ...
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ chai.use(chaiAsPromised)
|
|||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
|
||||||
describe('settings service', function () {
|
describe('settings service', function () {
|
||||||
this.timeout(Factory.TwentySecondTimeout)
|
this.timeout(Factory.ThirtySecondTimeout)
|
||||||
|
|
||||||
const validSetting = SettingName.GoogleDriveBackupFrequency
|
const validSetting = SettingName.GoogleDriveBackupFrequency
|
||||||
const fakePayload = 'Im so meta even this acronym'
|
const fakePayload = 'Im so meta even this acronym'
|
||||||
@@ -13,21 +13,20 @@ describe('settings service', function () {
|
|||||||
|
|
||||||
let application
|
let application
|
||||||
let context
|
let context
|
||||||
let user
|
|
||||||
|
|
||||||
beforeEach(async function () {
|
beforeEach(async function () {
|
||||||
|
localStorage.clear()
|
||||||
context = await Factory.createAppContextWithFakeCrypto()
|
context = await Factory.createAppContextWithFakeCrypto()
|
||||||
|
|
||||||
await context.launch()
|
await context.launch()
|
||||||
|
|
||||||
application = context.application
|
application = context.application
|
||||||
|
|
||||||
const registerResponse = await Factory.registerUserToApplication({
|
await Factory.registerUserToApplication({
|
||||||
application: context.application,
|
application: context.application,
|
||||||
email: context.email,
|
email: context.email,
|
||||||
password: context.password,
|
password: context.password,
|
||||||
})
|
})
|
||||||
user = registerResponse.user
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const reInitializeApplicationWithRealCrypto = async () => {
|
const reInitializeApplicationWithRealCrypto = async () => {
|
||||||
@@ -39,16 +38,16 @@ describe('settings service', function () {
|
|||||||
|
|
||||||
application = context.application
|
application = context.application
|
||||||
|
|
||||||
const registerResponse = await Factory.registerUserToApplication({
|
await Factory.registerUserToApplication({
|
||||||
application: context.application,
|
application: context.application,
|
||||||
email: context.email,
|
email: context.email,
|
||||||
password: context.password,
|
password: context.password,
|
||||||
})
|
})
|
||||||
user = registerResponse.user
|
|
||||||
}
|
}
|
||||||
|
|
||||||
afterEach(async function () {
|
afterEach(async function () {
|
||||||
await Factory.safeDeinit(application)
|
await Factory.safeDeinit(application)
|
||||||
|
localStorage.clear()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('creates and reads a setting', async function () {
|
it('creates and reads a setting', async function () {
|
||||||
@@ -133,7 +132,7 @@ describe('settings service', function () {
|
|||||||
payAmount: 59.00
|
payAmount: 59.00
|
||||||
})
|
})
|
||||||
|
|
||||||
await Factory.sleep(1)
|
await Factory.sleep(2)
|
||||||
|
|
||||||
const setting = await application.settings.getSubscriptionSetting('FILE_UPLOAD_BYTES_LIMIT')
|
const setting = await application.settings.getSubscriptionSetting('FILE_UPLOAD_BYTES_LIMIT')
|
||||||
expect(setting).to.be.a('string')
|
expect(setting).to.be.a('string')
|
||||||
@@ -157,7 +156,7 @@ describe('settings service', function () {
|
|||||||
billingFrequency: 12,
|
billingFrequency: 12,
|
||||||
payAmount: 59.00
|
payAmount: 59.00
|
||||||
})
|
})
|
||||||
await Factory.sleep(1)
|
await Factory.sleep(2)
|
||||||
|
|
||||||
const response = await fetch('/packages/snjs/mocha/assets/small_file.md')
|
const response = await fetch('/packages/snjs/mocha/assets/small_file.md')
|
||||||
const buffer = new Uint8Array(await response.arrayBuffer())
|
const buffer = new Uint8Array(await response.arrayBuffer())
|
||||||
@@ -183,7 +182,7 @@ describe('settings service', function () {
|
|||||||
billingFrequency: 12,
|
billingFrequency: 12,
|
||||||
payAmount: 59.00
|
payAmount: 59.00
|
||||||
})
|
})
|
||||||
await Factory.sleep(1)
|
await Factory.sleep(2)
|
||||||
|
|
||||||
await Factory.publishMockedEvent('SUBSCRIPTION_PURCHASED', {
|
await Factory.publishMockedEvent('SUBSCRIPTION_PURCHASED', {
|
||||||
userEmail: context.email,
|
userEmail: context.email,
|
||||||
@@ -200,7 +199,7 @@ describe('settings service', function () {
|
|||||||
billingFrequency: 12,
|
billingFrequency: 12,
|
||||||
payAmount: 59.00
|
payAmount: 59.00
|
||||||
})
|
})
|
||||||
await Factory.sleep(1)
|
await Factory.sleep(2)
|
||||||
|
|
||||||
const limitSettingAfter = await application.settings.getSubscriptionSetting('FILE_UPLOAD_BYTES_LIMIT')
|
const limitSettingAfter = await application.settings.getSubscriptionSetting('FILE_UPLOAD_BYTES_LIMIT')
|
||||||
expect(limitSettingAfter).to.equal(limitSettingBefore)
|
expect(limitSettingAfter).to.equal(limitSettingBefore)
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ describe('subscriptions', function () {
|
|||||||
billingFrequency: 12,
|
billingFrequency: 12,
|
||||||
payAmount: 59.00
|
payAmount: 59.00
|
||||||
})
|
})
|
||||||
await Factory.sleep(0.25)
|
await Factory.sleep(2)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should invite a user by email to a shared subscription', async () => {
|
it('should invite a user by email to a shared subscription', async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user