Commit Graph

13 Commits

Author SHA1 Message Date
Jonathan Bobel
afd82f3742 Separated the js to make it easier to test 2024-07-18 15:27:17 -04:00
Jonathan Bobel
2e81f6f45a Checking if the threshold is why this branch is failing 2024-07-18 13:14:36 -04:00
Jonathan Bobel
47bb1e4c8c Test updates - still need more coverage 2024-07-18 12:36:49 -04:00
Jonathan Bobel
ba2b5fea37 Merge branch '1544-data-viz-total-message-allowance' into 1484-dashboard-visualizations
# Conflicts:
#	app/assets/sass/uswds/_data-visualization.scss
#	app/assets/sass/uswds/styles.scss
#	app/templates/views/dashboard/dashboard.html
#	app/templates/views/dashboard/template-statistics.html
#	gulpfile.js
#	package-lock.json
2024-07-17 11:23:53 -04:00
Jonathan Bobel
149c23b721 Updates to the tests, committing as they currently run but I need to work on the coverage 2024-06-27 11:01:31 -04:00
Jonathan Bobel
c02c9152d8 Writing tests for chartDashboard.js 2024-06-05 11:25:15 -04:00
Carlo Costino
a46a21a519 Revert recent changes for window location updates
There are a few other things at play that will require more investigation at a future date:

- Why window.location.assign() or history.pushState() do not work
- If any other config or polyfills are needed with JSDOM

Signed-off-by: Carlo Costino <carlo.costino@gsa.gov>
2023-10-12 10:00:30 -04:00
Andrew Shumway
575c2b7d75 Notify 473: add code coverage for jest (#488) 2023-05-02 16:38:28 -04:00
Ryan Ahearn
bb2d57b27b Update tests to use most recent jest and supporting libraries 2022-10-27 11:12:39 -04:00
Ben Thorner
3a4601bbe4 Set window location for individual test
This is less surprising and means we don't end up in a situation
where a future test needs to change the global config to something
else.
2021-06-09 12:23:24 +01:00
Leo Hemsted
bb7343d846 pass nextUrl through yubikey flow
the next url comes from sign in via a query param, and needs to go to
the POST /webauthn/authenticate endpoint. That endpoint logs the user
in and returns the redirect to the browser, and will take the next from
the request query params to get there.

also moving the window mocks to beforeEach/afterEach ensures that
promise callbacks from previous tests aren't still associated in future
tests to ensure good test isolation.

unfortunately i couldn't get mocking location for a single js test to
work, but by changing the global config i was able to add some query
params that i can expect to be passed through. Don't love this at all
but not quite sure of a good way round this. I think we're not
practicing very good hygiene and best practices with our mocking and
it's really confounding me here.
2021-06-04 12:52:40 +01:00
Tom Byers
98e48e68f9 Change the URL JSDOM uses for the current page
https://jestjs.io/docs/en/configuration#testurl-string

Affects all DOM APIs that return information about
the URL, for example window.location.

Why:

We now have tests for setting/deleting cookies.
Tough-cookie, the library JSDOM uses for cookie
handling cookies doesn't allow setting cookies
with `domain=localhost`. This is correct by
RFC6265, the standard it follows, as domains must
have 2 or more `.`s in them.

The only way to set a cookie on `localhost` is to
leave out the `domain` attribute.

The code we are testing sets and deletes cookies
set on specific domains so using `localhost` is
out.

We also cannot just set/delete cookies on the
domains used as cookies are required to match the
domain of the current page.

The solution we are left with is to set the
current page to one from production and make sure
each cookie is set relative to that domain.

Note: this introduces `testURL` in isolation to be
sure it doesn't break any existing tests.
2020-01-22 11:08:29 +00:00
Tom Byers
0131f0c1b1 Move setup/teardown out of tests 2019-06-12 16:03:18 +01:00