Skip to content

Commit

Permalink
refactor: clean up DOM storage test
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobq committed Nov 11, 2018
1 parent 65310bf commit f9193d5
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions spec/chromium-spec.js
Expand Up @@ -939,17 +939,14 @@ describe('chromium feature', () => {
describe('storage', () => {
describe('DOM storage quota override', () => {
['localStorage', 'sessionStorage'].forEach((storageName) => {
it(`can store at least 50MiB in ${storageName}`, (done) => {
assert.doesNotThrow(() => {
const storage = window[storageName]
const testKeyName = '_electronDOMStorageQuotaOverrideTest'
// 25 * 2^20 UTF-16 characters will require 50MiB
const arraySize = 25 * Math.pow(2, 20)
storage[testKeyName] = new Array(arraySize).fill('X').join('')
expect(storage[testKeyName])to.have.lengthOf(arraySize)
delete storage[testKeyName]
done()
})
it(`allows saving at least 50MiB in ${storageName}`, () => {
const storage = window[storageName]
const testKeyName = '_electronDOMStorageQuotaOverrideTest'
// 25 * 2^20 UTF-16 characters will require 50MiB
const arraySize = 25 * Math.pow(2, 20)
storage[testKeyName] = new Array(arraySize).fill('X').join('')
expect(storage[testKeyName]).to.have.lengthOf(arraySize)
delete storage[testKeyName]
})
})
})
Expand Down

0 comments on commit f9193d5

Please sign in to comment.