Skip to content

Commit

Permalink
Add failing test for #102
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Mar 16, 2022
1 parent 9d535a3 commit 07f5344
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,45 @@ test('.get()', t => {
t.is(t.context.config.get('foo'), fixture);
});

test('.get() - `defaults` option', t => {
const store = new Conf({
cwd: tempy.directory(),
defaults: {
foo: 42,
nested: {
bar: 55
}
}
});

t.is(store.get('foo'), 42);
t.is(store.get('nested.bar'), 55);
});

test.failing('.get() - `schema` option - default', t => {
const store = new Conf({
cwd: tempy.directory(),
schema: {
foo: {
type: 'boolean',
default: true
},
nested: {
type: 'object',
properties: {
bar: {
type: 'number',
default: 55
}
}
}
}
});

t.is(store.get('foo'), true);
t.is(store.get('nested.bar'), 55); // See: https://github.com/sindresorhus/electron-store/issues/102
});

test('.set()', t => {
t.context.config.set('foo', fixture);
t.context.config.set('baz.boo', fixture);
Expand Down

0 comments on commit 07f5344

Please sign in to comment.