open-formulieren / open-forms-sdk

A Javascript SDK for Open Forms
https://open-forms.readthedocs.io/en/stable/developers/sdk/index.html
Other
2 stars 6 forks source link

Pre-select product via query string #544

Closed sergei-maertens closed 1 year ago

sergei-maertens commented 1 year ago

Closes open-formulieren/open-forms#3300

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.06% :warning:

Comparison is base (dc963be) 70.27% compared to head (94f907e) 70.22%. Report is 6 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #544 +/- ## ========================================== - Coverage 70.27% 70.22% -0.06% ========================================== Files 205 206 +1 Lines 4235 4248 +13 Branches 1149 1150 +1 ========================================== + Hits 2976 2983 +7 - Misses 1229 1232 +3 - Partials 30 33 +3 ``` | [Files Changed](https://app.codecov.io/gh/open-formulieren/open-forms-sdk/pull/544?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-formulieren) | Coverage Δ | | |---|---|---| | [src/components/App.js](https://app.codecov.io/gh/open-formulieren/open-forms-sdk/pull/544?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-formulieren#diff-c3JjL2NvbXBvbmVudHMvQXBwLmpz) | `95.45% <100.00%> (+0.21%)` | :arrow_up: | | [src/components/appointments/ChooseProductStep.js](https://app.codecov.io/gh/open-formulieren/open-forms-sdk/pull/544?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-formulieren#diff-c3JjL2NvbXBvbmVudHMvYXBwb2ludG1lbnRzL0Nob29zZVByb2R1Y3RTdGVwLmpz) | `100.00% <100.00%> (ø)` | | | [...omponents/appointments/CreateAppointment/routes.js](https://app.codecov.io/gh/open-formulieren/open-forms-sdk/pull/544?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-formulieren#diff-c3JjL2NvbXBvbmVudHMvYXBwb2ludG1lbnRzL0NyZWF0ZUFwcG9pbnRtZW50L3JvdXRlcy5qcw==) | `100.00% <100.00%> (ø)` | | | [src/components/appointments/DateSelect.js](https://app.codecov.io/gh/open-formulieren/open-forms-sdk/pull/544?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-formulieren#diff-c3JjL2NvbXBvbmVudHMvYXBwb2ludG1lbnRzL0RhdGVTZWxlY3QuanM=) | `96.42% <100.00%> (ø)` | | | [src/components/appointments/TimeSelect.js](https://app.codecov.io/gh/open-formulieren/open-forms-sdk/pull/544?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-formulieren#diff-c3JjL2NvbXBvbmVudHMvYXBwb2ludG1lbnRzL1RpbWVTZWxlY3QuanM=) | `96.15% <100.00%> (ø)` | | | [src/components/appointments/utils.js](https://app.codecov.io/gh/open-formulieren/open-forms-sdk/pull/544?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-formulieren#diff-c3JjL2NvbXBvbmVudHMvYXBwb2ludG1lbnRzL3V0aWxzLmpz) | `100.00% <100.00%> (ø)` | | ... and [3 files with indirect coverage changes](https://app.codecov.io/gh/open-formulieren/open-forms-sdk/pull/544/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-formulieren)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

sergei-maertens commented 1 year ago

I don't recognise hash based routing tests, is that something we get for free from some library by setting REACT_APP_USE_HASH_ROUTING=true in the env?

It's something we handle ourselves in sdk.js by selecting a different router:

    const createRouter = this.useHashRouting ? createHashRouter : createBrowserRouter;
    const router = createRouter(routes, {basename: this.basePath});

so that makes it impossible to test, since we use createMemoryRouter in tests. I've verified it manually and I suppose that's the best we can do, short of an end-to-end tests with a real backend.