-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(test): skip rather than comment out so the precommit hook works (#…
- Loading branch information
Showing
1 changed file
with
48 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
}) | ||
}) |