Skip to content

Commit

Permalink
add env tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pgayvallet committed Jul 14, 2023
1 parent 2fd0a00 commit f50a035
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/kbn-config/src/__snapshots__/env.test.ts.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions packages/kbn-config/src/env.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,3 +208,43 @@ test('pluginSearchPaths only includes kibana-extra, regardless of plugin filters

expect(env4.pluginSearchPaths).toEqual(['/some/home/kibana-extra', '/some/home/dir/plugins']);
});

describe('packageInfo.buildFlavor', () => {
it('is set to `serverless` when the `serverless` cli flag is `true`', () => {
mockPackage.raw = {
branch: 'some-branch',
version: 'some-version',
};

const env = Env.createDefault(
REPO_ROOT,
getEnvOptions({
configs: ['/test/cwd/config/kibana.yml'],
cliArgs: {
serverless: true,
},
})
);

expect(env.packageInfo.buildFlavor).toEqual('serverless');
});

it('is set to `traditional` when the `serverless` cli flag is `false`', () => {
mockPackage.raw = {
branch: 'some-branch',
version: 'some-version',
};

const env = Env.createDefault(
REPO_ROOT,
getEnvOptions({
configs: ['/test/cwd/config/kibana.yml'],
cliArgs: {
serverless: false,
},
})
);

expect(env.packageInfo.buildFlavor).toEqual('traditional');
});
});

0 comments on commit f50a035

Please sign in to comment.