-
-
Notifications
You must be signed in to change notification settings - Fork 155
/
fixture.js
40 lines (30 loc) · 905 Bytes
/
fixture.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import process from 'node:process';
import assert from 'node:assert';
import electron from 'electron';
import Store from './index.js';
// Prevent Electron from never exiting when an exception happens
process.on('uncaughtException', error => {
console.error('Exception:', error);
process.exit(1);
});
const store = new Store({name: 'electron-store'});
const storeWithSchema = new Store({
name: 'electron-store-with-schema',
schema: {
foo: {
default: 42,
},
},
});
store.set('unicorn', '🦄');
assert.strictEqual(store.get('unicorn'), '🦄');
store.delete('unicorn');
assert.strictEqual(store.get('unicorn'), undefined);
storeWithSchema.set('foo', 77);
assert.strictEqual(storeWithSchema.get('foo'), 77);
storeWithSchema.reset('foo');
assert.strictEqual(storeWithSchema.get('foo'), 42);
// To be checked in AVA
store.set('ava', '🚀');
console.log(store.path);
electron.app.quit();