Skip to content

Add unit tests for manual add project flow#618

Open
sharma1208 wants to merge 3 commits into
OpenLiberty:mainfrom
sharma1208:unit-test-manual-add
Open

Add unit tests for manual add project flow#618
sharma1208 wants to merge 3 commits into
OpenLiberty:mainfrom
sharma1208:unit-test-manual-add

Conversation

@sharma1208

@sharma1208 sharma1208 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Adds unit test coverage for the manual add project flow in Liberty Tools. Adressing #617

Changes

added a unit test setup for running TypeScript-based unit tests with Mocha
added unit tests for addUserSelectedPath()

covered manual add success (0), duplicate (1), and invalid project (2) return cases
verified live dashboard map updates and workspace storage persistence behavior
added unit tests for addProjectsToTheDashBoard()
verified command-layer behavior for all manual add result codes, including expected message handling and dashboard refresh behavio

@sharma1208 sharma1208 requested a review from mattbsox July 2, 2026 14:34

@mattbsox mattbsox left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Small changes. Can maybe add copyrights to the test files too.

Comment thread package-lock.json

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we can use the public versions of the new dependencies. I don't think we need to pull in from an internal registry.

Comment thread package.json Outdated
"test-maven": "npm run test-compile && extest setup-and-run -o .vscode/settings.json 'out/test/M*.js' --code_settings src/test/resources/settings.json",
"test-gradle": "npm run test-compile && extest setup-and-run -o .vscode/settings.json 'out/test/G*.js' --code_settings src/test/resources/settings.json"
"test-gradle": "npm run test-compile && extest setup-and-run -o .vscode/settings.json 'out/test/G*.js' --code_settings src/test/resources/settings.json",
"test:unit": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' node --require ts-node/register node_modules/.bin/mocha --config .mocharc.unit.yml"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit-picky, maybe test-unit or unit-tests?

@sharma1208 sharma1208 requested review from dshimo and mattbsox July 6, 2026 15:56
- Extracted shared fakeVscode.ts with installFakeVscode()

- Remove TS_NODE_COMPILER_OPTIONS from test-unit script in package.json since tsconfig.json already specifies module: commonjs
- Simplify addUserSelectedPath Test 1 — remove unnecessary existsSyncStub
  and readFileStub wrappers since createLibertyProject is fully replaced
  with a fake and no real file I/O occurs
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