Skip to content

Commit

Permalink
fix config again
Browse files Browse the repository at this point in the history
  • Loading branch information
pgayvallet committed May 12, 2021
1 parent 73bd9f6 commit 3aa3b71
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { Config } from './config';

describe('Config', () => {
it('recognize keys under `object().pattern`', () => {
const config = new Config({
settings: {
services: {
foo: () => 42,
},
},
primary: true,
path: process.cwd(),
});

expect(config.has('services.foo')).toEqual(true);
expect(config.get('services.foo')()).toEqual(42);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class Config {
values: Record<string, any>,
childSchema: any
): boolean {
if (!childSchema.$_terms.keys) {
if (!childSchema.$_terms.keys && !childSchema.$_terms.patterns) {
return false;
}

Expand Down

0 comments on commit 3aa3b71

Please sign in to comment.