diff --git a/packages/kbn-test/src/functional_test_runner/lib/config/config.test.ts b/packages/kbn-test/src/functional_test_runner/lib/config/config.test.ts new file mode 100644 index 0000000000000..2d764da785573 --- /dev/null +++ b/packages/kbn-test/src/functional_test_runner/lib/config/config.test.ts @@ -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); + }); +}); diff --git a/packages/kbn-test/src/functional_test_runner/lib/config/config.ts b/packages/kbn-test/src/functional_test_runner/lib/config/config.ts index 9875fae8b0a86..1d4af9c33fb79 100644 --- a/packages/kbn-test/src/functional_test_runner/lib/config/config.ts +++ b/packages/kbn-test/src/functional_test_runner/lib/config/config.ts @@ -50,7 +50,7 @@ export class Config { values: Record, childSchema: any ): boolean { - if (!childSchema.$_terms.keys) { + if (!childSchema.$_terms.keys && !childSchema.$_terms.patterns) { return false; }