Skip to content

Commit

Permalink
[Tests] update zip files in cli_plugin
Browse files Browse the repository at this point in the history
Updated references to OpenSearch and OpenSearch Dashboards for
the zipped files with the cli_plugin for the tests to pass.

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
  • Loading branch information
kavilla committed Mar 25, 2021
1 parent c314dbd commit 8c44e54
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 4 deletions.
Binary file modified src/cli_plugin/install/__fixtures__/replies/invalid_name.zip
Binary file not shown.
Binary file modified src/cli_plugin/install/__fixtures__/replies/test_plugin.zip
Binary file not shown.
Binary file not shown.
Binary file modified src/cli_plugin/install/__fixtures__/replies/test_plugin_many.zip
Binary file not shown.
Binary file not shown.
4 changes: 2 additions & 2 deletions src/cli_plugin/install/pack.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ describe('opensearchDashboards cli', function () {
"bin",
"bin/executable",
"bin/not-executable",
"opensearch_dashboards.json",
"node_modules",
"node_modules/some-package",
"node_modules/some-package/index.js",
"node_modules/some-package/package.json",
"opensearch_dashboards.json",
"public",
"public/index.js",
]
Expand Down Expand Up @@ -170,7 +170,7 @@ describe('opensearchDashboards cli', function () {
it('throw an error if there an invalid plugin name', async () => {
await copyReplyFile('invalid_name.zip');
await expect(getPackData(settings, logger)).rejects.toThrowErrorMatchingInlineSnapshot(
`"No opensearch-dashboards plugins found in archive"`
`"Invalid plugin name [invalid name] in opensearch_dashboards.json, expected it to be valid camelCase"`
);
});
});
Expand Down
25 changes: 23 additions & 2 deletions src/cli_plugin/install/zip.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,15 @@ describe('opensearchDashboards cli', function () {
describe('analyzeArchive', function () {
it('returns array of plugins', async () => {
const packages = await analyzeArchive(archivePath);
expect(packages).toMatchInlineSnapshot(`Array []`);
expect(packages).toMatchInlineSnapshot(`
Array [
Object {
"id": "testPlugin",
"opensearchDashboardsVersion": "1.0.0",
"stripPrefix": "opensearch-dashboards/test-plugin",
},
]
`);
});
});

Expand All @@ -56,7 +64,20 @@ describe('opensearchDashboards cli', function () {
const archive = path.resolve(repliesPath, 'test_plugin.zip');
await extractArchive(archive, tempPath, 'opensearch-dashboards/test-plugin');

expect(glob.sync('**/*', { cwd: tempPath })).toMatchInlineSnapshot(`Array []`);
expect(glob.sync('**/*', { cwd: tempPath })).toMatchInlineSnapshot(`
Array [
"bin",
"bin/executable",
"bin/not-executable",
"node_modules",
"node_modules/some-package",
"node_modules/some-package/index.js",
"node_modules/some-package/package.json",
"opensearch_dashboards.json",
"public",
"public/index.js",
]
`);
});
});

Expand Down

0 comments on commit 8c44e54

Please sign in to comment.