Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test cases and update dashboards code to account for generic path #22

Merged
merged 5 commits into from
May 2, 2022

Conversation

johnnyon-amzn
Copy link
Contributor

@johnnyon-amzn johnnyon-amzn commented May 2, 2022

Description

Initial start of adding test cases to project.

Issues Resolved

#18

Test cases

 PASS  test/jest/dashboard.test.js
  Config Test
    ✓ Getting config (2 ms)
    ✓ Setting config (14 ms)

Test Suites: 1 passed, 1 total
Tests:       2 passed, 2 total
Snapshots:   0 total
Time:        0.466 s, estimated 1 s

@johnnyon-amzn johnnyon-amzn requested a review from a team May 2, 2022 21:36
@johnnyon-amzn johnnyon-amzn self-assigned this May 2, 2022
@johnnyon-amzn johnnyon-amzn changed the title Dev Add test cases and update dashboards code to account for generic path May 2, 2022
@seraphjiang
Copy link
Member

didn't pass DCO check

i think it need to signoff commit message

@@ -0,0 +1,29 @@
const path = require('path');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we group all type of tests (UT, IT, FRT) into test folder like src folder

Copy link
Contributor Author

@johnnyon-amzn johnnyon-amzn May 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the __tests__ folder count?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.



function getConfig() {
function getConfig(CONFIG_PATH=CONFIG_PATH) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change variable name to configPath to avoid confusion

Copy link
Member

@seraphjiang seraphjiang May 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The JS closure concept, it is trick to tell CONFIG_PATH is local variable, method variable or global variable to non-js developer.

let's use clear variable name for each scope to avoid that.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Closures#closure

@@ -0,0 +1,29 @@
const path = require('path');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

config[key] = value;
fs.writeFile(CONFIG_PATH, JSON.stringify(config), callback);
fs.writeFile(config_path, JSON.stringify(config), callback);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in 9642596

Copy link
Member

@seraphjiang seraphjiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good progress. You may address comment in another PR.

@@ -13,14 +13,24 @@ const superagent = require('superagent');
const CONFIG_PATH = path.join(__dirname, "config.json");


<<<<<<< HEAD
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merge conflict 😂

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was trying to rebase and messed up. I hard reset to the previous commit I had

@seraphjiang
Copy link
Member

DCO check seems, failed again

Copy link
Member

@seraphjiang seraphjiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, ship it

@johnnyon-amzn johnnyon-amzn merged commit 8733807 into opensearch-project:dev May 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants