Skip to content

Commit

Permalink
fix(test): skip rather than comment out so the precommit hook works (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
josephmcg authored Jul 11, 2022
1 parent 1c1b546 commit bc72f72
Showing 1 changed file with 48 additions and 48 deletions.
96 changes: 48 additions & 48 deletions store/settings/actions.test.ts
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
// import { Dexie } from 'dexie'
// import Vue from 'vue'
// import * as actions from './actions'
// import { SettingsError } from './types'
// import { db } from '~/libraries/SatelliteDB/SatelliteDB'
// import TextileManager from '~/libraries/Textile/TextileManager'
import { Dexie } from 'dexie'
import Vue from 'vue'
import * as actions from './actions'
import { SettingsError } from './types'
import { db } from '~/libraries/SatelliteDB/SatelliteDB'
import TextileManager from '~/libraries/Textile/TextileManager'

// describe('actions.default', () => {
// const original = window.location
describe('actions.default', () => {
const original = window.location

// beforeAll(() => {
// Object.defineProperty(window, 'location', {
// configurable: true,
// value: { reload: jest.fn() },
// })
// })
beforeAll(() => {
Object.defineProperty(window, 'location', {
configurable: true,
value: { reload: jest.fn() },
})
})

// afterAll(() => {
// Object.defineProperty(window, 'location', {
// configurable: true,
// value: original,
// })
// })
afterAll(() => {
Object.defineProperty(window, 'location', {
configurable: true,
value: original,
})
})

// test('actions.default.clearLocalStorage successful', async () => {
// Vue.prototype.$TextileManager = new TextileManager()
// db.delete = jest.fn().mockReturnValue(true)
// Dexie.exists = jest.fn().mockReturnValue(true)
// await actions.default.clearLocalStorage()
// })
test.skip('actions.default.clearLocalStorage successful', async () => {
Vue.prototype.$TextileManager = new TextileManager()
db.delete = jest.fn().mockReturnValue(true)
Dexie.exists = jest.fn().mockReturnValue(true)
await actions.default.clearLocalStorage()
})

// test('actions.default.clearLocalStorage error', async () => {
// Vue.prototype.$TextileManager = new TextileManager()
// try {
// db.delete = jest.fn().mockImplementation(() => {
// throw new Error('mock error')
// })
// await actions.default.clearLocalStorage()
// } catch (error) {
// expect(error).toBeInstanceOf(Error)
// expect(error).toHaveProperty(
// 'message',
// SettingsError.DATABASE_NOT_CLEARED,
// )
// }
// })
test.skip('actions.default.clearLocalStorage error', async () => {
Vue.prototype.$TextileManager = new TextileManager()
try {
db.delete = jest.fn().mockImplementation(() => {
throw new Error('mock error')
})
await actions.default.clearLocalStorage()
} catch (error) {
expect(error).toBeInstanceOf(Error)
expect(error).toHaveProperty(
'message',
SettingsError.DATABASE_NOT_CLEARED,
)
}
})

// test('actions.default.clearLocalStorage successful but dexies does not exist', async () => {
// Vue.prototype.$TextileManager = new TextileManager()
// db.delete = jest.fn().mockReturnValue(true)
// Dexie.exists = jest.fn().mockReturnValue(undefined)
// await actions.default.clearLocalStorage()
// })
// })
test.skip('actions.default.clearLocalStorage successful but dexies does not exist', async () => {
Vue.prototype.$TextileManager = new TextileManager()
db.delete = jest.fn().mockReturnValue(true)
Dexie.exists = jest.fn().mockReturnValue(undefined)
await actions.default.clearLocalStorage()
})
})

0 comments on commit bc72f72

Please sign in to comment.