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

[DLT-1110] Mapped Collection Endpoint Browse Tests (2/4) #1207

Conversation

AronPerez
Copy link
Collaborator

@AronPerez AronPerez commented Jan 3, 2025

PR Description

This PR adds Chai unit tests

Tasks

  • - A description of the PR has been provided, and a diagram included if it is a new feature.
  • - Formatter has been run
  • - CHANGELOG comment has been added
  • - Labels have been assigned to the pr
  • - A reviwer has been added
  • - A user has been assigned to work on the pr
  • - If new feature a unit test has been added

Summary by Sourcery

Tests:

  • Add unit tests for the mapped collection endpoint browse functionality.

@AronPerez AronPerez force-pushed the feat/DLT-1110/mapped-collection-endpoint-browse branch from d0215b7 to db9280d Compare January 3, 2025 16:48
@AronPerez AronPerez force-pushed the feat/DLT-1110/mapped-collection-endpoint-browse-tests branch from 3ed0070 to 500ba5b Compare January 3, 2025 16:49
@AronPerez AronPerez changed the title [DLT-1110] Mapped Collection Endpoint Browse Tests [DLT-1110] Mapped Collection Endpoint Browse Tests (2/4) Jan 3, 2025
@AronPerez AronPerez force-pushed the feat/DLT-1110/mapped-collection-endpoint-browse-tests branch from c8672c0 to 39b451c Compare January 6, 2025 20:39
@AronPerez AronPerez marked this pull request as ready for review January 7, 2025 21:44
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @AronPerez - I've reviewed your changes - here's some feedback:

Overall Comments:

  • The path handling change in transfer-ui-manager.js (removal of endsWith check) appears to be a behavioral change. Please clarify if this is intentional and how it affects the directory path handling.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@AronPerez
Copy link
Collaborator Author

Atrifacts

Unit Test validation

  1. npm run test

Screenshot 2025-01-07 at 4 32 45 PM

Copy link
Collaborator

@t-ramz t-ramz left a comment

Choose a reason for hiding this comment

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

Added a few comments/questions, and one concern.

web/static/components/transfer/transfer-ui-manager.js Outdated Show resolved Hide resolved
web/test/setup.js Outdated Show resolved Hide resolved
web/test/setup.js Outdated Show resolved Hide resolved
web/test/components/transfer/transfer-ui-manager.test.js Outdated Show resolved Hide resolved
web/test/components/transfer/transfer-ui-manager.test.js Outdated Show resolved Hide resolved
Copy link
Collaborator

@JoshuaSBrown JoshuaSBrown left a comment

Choose a reason for hiding this comment

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

A positive contribution, adding first set of unit tests to the Frontend. I don't have any items that should be blocking for this PR if passing the CI. It would probably be a good idea to continute expand on the unit testing with some integration testing. One of the difficult parts of the current design is the different components are kind of tightly coupled. Perhaps it will make sense to put the api call pieces directly in some of the classes that are closely related at some point.

@AronPerez AronPerez force-pushed the feat/DLT-1110/mapped-collection-endpoint-browse branch 3 times, most recently from 939f7f9 to c99d09d Compare January 10, 2025 20:17
@AronPerez AronPerez force-pushed the feat/DLT-1110/mapped-collection-endpoint-browse-tests branch 4 times, most recently from a23cc88 to 5dc8181 Compare January 14, 2025 18:43
@AronPerez AronPerez force-pushed the feat/DLT-1110/mapped-collection-endpoint-browse branch from dbe7432 to 3679a4f Compare January 14, 2025 18:46
@AronPerez AronPerez force-pushed the feat/DLT-1110/mapped-collection-endpoint-browse-tests branch from 5dc8181 to f939461 Compare January 14, 2025 18:46
@AronPerez
Copy link
Collaborator Author

Artifacts

npm run test in web/

Screen.Recording.2025-01-14.at.1.27.00.PM.mov

npm install in web/

Screenshot 2025-01-14 at 1 26 38 PM

@ORNL ORNL deleted a comment from sourcery-ai bot Jan 14, 2025
@AronPerez
Copy link
Collaborator Author

@sourcery-ai review

Copy link

sourcery-ai bot commented Jan 14, 2025

Reviewer's Guide by Sourcery

This PR adds unit tests for the Mapped Collection Endpoint Browse feature. It introduces Chai unit tests for the transfer-dialog-controller, transfer-endpoint-manager, and transfer-ui-manager components. Additionally, it updates the prettier dependency to version 3.4.2 and includes several new testing-related files.

Class diagram for transfer components under test

classDiagram
    class TransferDialogController {
        +handleDialog()
    }
    class TransferEndpointManager {
        +manageEndpoints()
    }
    class TransferUIManager {
        +manageUI()
    }

    TransferDialogController --> TransferUIManager
    TransferEndpointManager --> TransferUIManager

    note for TransferDialogController "Unit tests added"
    note for TransferEndpointManager "Unit tests added"
    note for TransferUIManager "Unit tests added"
Loading

File-Level Changes

Change Details Files
Added Chai unit tests for various transfer components.
  • Created new test files for each of the components.
  • Implemented unit tests using Chai and Sinon to cover core functionality.
  • Mocked necessary dependencies and UI elements for isolated testing scenarios.
  • Added a setup file to configure the testing environment, including JSDOM, jQuery, and error handling.
  • Created fixtures to mock services and jQuery components for consistent test setup.
  • Added a Mocha configuration file to define test settings and include the setup file.
  • Updated the Javascript Format workflow to use Prettier 3.4.2 for code formatting consistency.
web/test/components/transfer/transfer-dialog-controller.test.js
web/test/components/transfer/transfer-endpoint-manager.test.js
web/test/components/transfer/transfer-ui-manager.test.js
Updated npm dependencies and added new files for testing setup.
  • Updated the package.json.in file to include necessary testing dependencies.
  • Created a setup.js file to configure the testing environment.
  • Created transfer-fixtures.js to provide mock data and services for testing.
  • Added a .mocharc.cjs file to configure Mocha test runner options.
  • Updated the javascript-format.yml workflow file to install Prettier 3.4.2.
web/package.json.in
web/test/setup.js
web/test/fixtures/transfer-fixtures.js
web/.mocharc.cjs

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @AronPerez - I've reviewed your changes - here's some feedback:

Overall Comments:

  • The PR includes empty test files (transfer-dialog-controller.test.js, transfer-endpoint-manager.test.js, transfer-ui-manager.test.js). Please implement the actual test cases before requesting review.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@@ -18,7 +18,7 @@ jobs:
# Step 3: Install Prettier and ESLint globally
- name: Install Prettier
run: |
npm install -g prettier
Copy link
Collaborator

Choose a reason for hiding this comment

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

Good catch.

Copy link
Collaborator

@t-ramz t-ramz left a comment

Choose a reason for hiding this comment

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

LGTM

@AronPerez AronPerez merged commit 22545fa into feat/DLT-1110/mapped-collection-endpoint-browse Jan 14, 2025
7 of 8 checks passed
AronPerez added a commit that referenced this pull request Jan 22, 2025
AronPerez added a commit that referenced this pull request Jan 22, 2025
This reverts commit 0a56039.

Revert "Revert "[DLT-1110] Upgrade node v23 -> v18, better jump""

This reverts commit b57bd27.

Revert "Revert "[DLT-1110] Upgrade node v14 -> v23""

This reverts commit 6e3cc52

Revert "[DLT-1110] Mapped Collection Endpoint Browse Tests (2/4) (#1207)"

This reverts commit 22545fa.

Revert "[DLT-1110] Config"

This reverts commit 82715f0.

Revert "[DLT-1110] Upgrade node v14 -> v23"

This reverts commit fb8b93d.

Revert "[DLT-1110] Upgrade node v23 -> v18, better jump"

This reverts commit 9d66847.

Revert "[DLT-1110] Correct ver .sh file"

This reverts commit 5c78c59.

[DLT-1110] Correct ver .sh file

[DLT-1110] Upgrade node v23 -> v18, better jump

[DLT-1110] Upgrade node v14 -> v23

[DLT-1110] Config

[DLT-1110] Mapped Collection Endpoint Browse Tests (2/4) (#1207)

* [DLT-1110] Add tests

* [DLT-1110] Update chai with mocha, attempt usage of mock-import

* [DLT-1110] Add mocha config, correct prettier

* [DLT-1110] Update tests, correct logic

* [DLT-1110] Update tests, add fixtures, update setup, lock in packages

* [DLT-1110] Update test

[DLT-1110] Update style
[DLT-1110] Update if statements
[DLT-1110] Dependency injection
[DLT-1110] Fix update bug
[DLT-1110] Pull out template HTML
[DLT-1110] Correct HTML escape, francy tree init
[DLT-1110] Add commnets to logic
[DLT-1110] Update model, make logic private, remove controller form transfer request when update or get
[DLT-1110] Split branches
[DLT-1110] Update files with prettier
[DLT-1110] Add controller unit tests
[DLT-1110] Remove debug
[DLT-1110] Correct import statements, endpoint list
[DLT-1110] Refactor out into MVC
[DLT-1110] Add debug
[DLT-1110] Functioning modal, needs refactoring
[DLT-1110] Refactor dlg start transfer using OOO programming. Should be MVC cased on what I'm seeing but we'll see
AronPerez added a commit that referenced this pull request Jan 22, 2025
AronPerez added a commit that referenced this pull request Jan 23, 2025
* [DLT-1110] Update style
[DLT-1110] Update if statements
[DLT-1110] Dependency injection
[DLT-1110] Fix update bug
[DLT-1110] Pull out template HTML
[DLT-1110] Correct HTML escape, francy tree init
[DLT-1110] Add commnets to logic
[DLT-1110] Update model, make logic private, remove controller form transfer request when update or get
[DLT-1110] Split branches
[DLT-1110] Update files with prettier
[DLT-1110] Add controller unit tests
[DLT-1110] Remove debug
[DLT-1110] Correct import statements, endpoint list
[DLT-1110] Refactor out into MVC
[DLT-1110] Add debug
[DLT-1110] Functioning modal, needs refactoring
[DLT-1110] Refactor dlg start transfer using OOO programming. Should be MVC cased on what I'm seeing but we'll see

* [DLT-1110] Mapped Collection Endpoint Browse Tests (2/4) (#1207)

* [DLT-1110] Add tests

* [DLT-1110] Update chai with mocha, attempt usage of mock-import

* [DLT-1110] Add mocha config, correct prettier

* [DLT-1110] Update tests, correct logic

* [DLT-1110] Update tests, add fixtures, update setup, lock in packages

* [DLT-1110] Update test

* [DLT-1110] Config

* [DLT-1110] Upgrade node v14 -> v23

* [DLT-1110] Upgrade node v23 -> v18, better jump

* [DLT-1110] Correct ver .sh file

* Revert "[DLT-1110] Correct ver .sh file"

This reverts commit 5c78c59.

* Revert "[DLT-1110] Upgrade node v23 -> v18, better jump"

This reverts commit 9d66847.

* Revert "[DLT-1110] Upgrade node v14 -> v23"

This reverts commit fb8b93d.

* Revert "[DLT-1110] Config"

This reverts commit 82715f0.

* Revert "[DLT-1110] Mapped Collection Endpoint Browse Tests (2/4) (#1207)"

This reverts commit 22545fa.
AronPerez added a commit that referenced this pull request Jan 24, 2025
* [DLT-1110] Add tests

* [DLT-1110] Update chai with mocha, attempt usage of mock-import

* [DLT-1110] Add mocha config, correct prettier

* [DLT-1110] Update tests, correct logic

* [DLT-1110] Update tests, add fixtures, update setup, lock in packages

* [DLT-1110] Update test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants