-
Notifications
You must be signed in to change notification settings - Fork 4
task/CDD-3279-BE-SPIKE-investigate-tooling-for-javascript-testing-CMS #3176
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
Draft
jeanpierrefouche-ukhsa
wants to merge
14
commits into
main
Choose a base branch
from
task/CDD-3279-BE-SPIKE-investigate-tooling-for-javascript-testing-CMS
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
46e13ff
task/CDD-3279-BE-SPIKE-investigate-tooling-for-javascript-testing-CMS
jeanpierrefouche-ukhsa e22c0fa
task/CDD-3279-BE-SPIKE-investigate-tooling-for-javascript-testing-CMS
jeanpierrefouche-ukhsa e803299
task/CDD-3279-BE-SPIKE-investigate-tooling-for-javascript-testing-CMS
jeanpierrefouche-ukhsa 662b1e8
task/CDD-3279-BE-SPIKE-investigate-tooling-for-javascript-testing-CMS
jeanpierrefouche-ukhsa 0ec3e5f
task/CDD-3279-BE-SPIKE-investigate-tooling-for-javascript-testing-CMS
jeanpierrefouche-ukhsa 514c421
task/CDD-3279-BE-SPIKE-investigate-tooling-for-javascript-testing-CMS
jeanpierrefouche-ukhsa 3dfe7a0
task/CDD-3279-BE-SPIKE-investigate-tooling-for-javascript-testing-CMS
jeanpierrefouche-ukhsa edcb40e
task/CDD-3279-BE-SPIKE-investigate-tooling-for-javascript-testing-CMS
jeanpierrefouche-ukhsa 6a67361
Remove junit.xml from cache
jeanpierrefouche-ukhsa c0147ed
task/CDD-3279-BE-SPIKE-investigate-tooling-for-javascript-testing-CMS
jeanpierrefouche-ukhsa 2c6bf5a
task/CDD-3279-BE-SPIKE-investigate-tooling-for-javascript-testing-CMS
jeanpierrefouche-ukhsa 1c74bbb
Merge branch 'main' into task/CDD-3279-BE-SPIKE-investigate-tooling-f…
jeanpierrefouche-ukhsa 1c9ca4f
task/CDD-3279-BE-SPIKE-investigate-tooling-for-javascript-testing-CMS
jeanpierrefouche-ukhsa b94fb9b
task/CDD-3279-BE-SPIKE-investigate-tooling-for-javascript-testing-CMS
jeanpierrefouche-ukhsa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,3 +34,6 @@ venv/ | |
|
|
||
| # Existing local SQLite database | ||
| db.sqlite3 | ||
|
|
||
| # Spec files used for jest tests | ||
| **/*.spec.js | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
jeanpierrefouche-ukhsa marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| /** | ||
| * @jest-environment jsdom | ||
| */ | ||
|
|
||
| const { setToWildcard, WILDCARD_ID_VALUE } = require("./permission_set.js"); | ||
|
jeanpierrefouche-ukhsa marked this conversation as resolved.
|
||
|
|
||
| describe("setToWildcard", () => { | ||
| test("sets dropdown to wildcard state correctly", () => { | ||
| // Arrange: create a fake select element | ||
| const select = document.createElement("select"); | ||
|
|
||
| // Add some existing options to ensure it gets cleared | ||
| const oldOption = document.createElement("option"); | ||
| oldOption.value = "123"; | ||
| oldOption.textContent = "Old"; | ||
| select.appendChild(oldOption); | ||
| select.value = "123"; | ||
|
|
||
| // Act | ||
| setToWildcard(select, "* All Items"); | ||
|
jeanpierrefouche-ukhsa marked this conversation as resolved.
|
||
|
|
||
| // Assert | ||
| expect(select.children.length).toBe(1); | ||
|
|
||
| const option = select.children[0]; | ||
| expect(option.value).toBe(WILDCARD_ID_VALUE); | ||
| expect(option.textContent).toBe("* All Items"); | ||
| expect(select.value).toBe(WILDCARD_ID_VALUE); | ||
| }); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| /** @type {import('jest').Config} */ | ||
| module.exports = { | ||
| testEnvironment: 'jsdom', | ||
|
|
||
| // 1. Where Jest looks for tests | ||
| roots: [ | ||
| '<rootDir>/auth_content/static/js', | ||
| '<rootDir>/cms/dashboard/static/js' | ||
| ], | ||
|
|
||
| // 2. How Jest finds test files | ||
| testMatch: [ | ||
| '**/*.spec.js', | ||
| ], | ||
|
|
||
| // 3. Ignore junk when discovering tests | ||
| testPathIgnorePatterns: [ | ||
| '/node_modules/', | ||
| '/static/admin/', | ||
| '/static/vendor/', | ||
| '/static/rest_framework/', | ||
| '/static/debug_toolbar/', | ||
| '/static/wagtail', | ||
| '/staticfiles/', | ||
| '/collected_static/', | ||
| String.raw`/static/.*\.[0-9a-f]{6,}\.js$` | ||
| ], | ||
|
|
||
| // 4. Coverage ON | ||
| collectCoverage: true, | ||
|
|
||
| // 5. What files to include in coverage | ||
| collectCoverageFrom: [ | ||
| '<rootDir>/auth_content/static/js/**/*.js', | ||
| '<rootDir>/cms/dashboard/static/js/**/*.js', | ||
|
|
||
| // EXCLUDE everything we don’t own | ||
| '!**/node_modules/**', | ||
| '!**/static/**/vendor/**', | ||
| '!**/static/admin/**', | ||
| '!**/static/rest_framework/**', | ||
| '!**/static/debug_toolbar/**', | ||
| '!**/static/wagtail*/**', | ||
| ], | ||
|
|
||
| // 6. Coverage output | ||
| coverageDirectory: '<rootDir>/coverage', | ||
|
|
||
| // 7. Coverage formats | ||
| coverageReporters: ['json-summary', 'text'], | ||
|
|
||
| // 8. Optional but useful | ||
| modulePathIgnorePatterns: [ | ||
| '<rootDir>/node_modules/', | ||
| ], | ||
|
|
||
| // 9. Coverage threshold | ||
| coverageThreshold: { | ||
| global: { | ||
| statements: 100, | ||
| branches: 100, | ||
| functions: 100, | ||
| lines: 100, | ||
| }, | ||
| }, | ||
|
|
||
| // 10. After jest environment has been loaded, run custom setup | ||
| setupFilesAfterEnv: ['./jest.setup.js'], | ||
|
|
||
| // 11. Reporters | ||
| reporters: ['default', 'jest-junit'], | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| // Extend Jest with DOM matchers for all tests | ||
| require("@testing-library/jest-dom"); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.