forked from WorldBrain/storex-hub
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1daa17b
commit 17cf418
Showing
4 changed files
with
138 additions
and
6 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
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
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,4 +1,5 @@ | ||
const STORAGE_VERSIONS: { [versionNumber: number]: Date } = { | ||
0: new Date('2020-03-03'), | ||
1: new Date('2020-04-01'), | ||
} | ||
export default STORAGE_VERSIONS |
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import pick from 'lodash/pick' | ||
import expect from 'expect'; | ||
import { createApiTestSuite } from "./index.tests"; | ||
|
||
export default createApiTestSuite('App settings', ({ it }) => { | ||
it('should store and retrieve app settings', async ({ createSession }) => { | ||
const { api: app } = await createSession() | ||
await app.registerApp({ name: 'contacts', identify: true }) | ||
|
||
const settings = { foo: 'spam', bar: 5, ham: false } | ||
await app.setAppSettings({ updates: { ...settings } }) | ||
expect(await app.getAppSettings({ keys: 'all' })).toEqual({ | ||
status: 'success', | ||
settings, | ||
}) | ||
expect(await app.getAppSettings({ keys: ['foo', 'bar'] })).toEqual({ | ||
status: 'success', | ||
settings: { foo: settings.foo, bar: settings.bar }, | ||
}) | ||
}) | ||
|
||
it('should delete app settings', async ({ createSession }) => { | ||
const { api: app } = await createSession() | ||
await app.registerApp({ name: 'contacts', identify: true }) | ||
|
||
const settings = { foo: 'spam', bar: 5, ham: false } | ||
await app.setAppSettings({ updates: { ...settings } }) | ||
|
||
await app.deleteAppSettings({ keys: ['foo'] }) | ||
expect(await app.getAppSettings({ keys: 'all' })).toEqual({ | ||
status: 'success', | ||
settings: pick(settings, ['bar', 'ham']), | ||
}) | ||
|
||
await app.deleteAppSettings({ keys: 'all' }) | ||
expect(await app.getAppSettings({ keys: 'all' })).toEqual({ | ||
status: 'success', | ||
settings: {}, | ||
}) | ||
}) | ||
}) |