Skip to content

Commit

Permalink
fix: corrected catalogue status mappings (#3529)
Browse files Browse the repository at this point in the history
* fix: adjusted tooltip descriptions

* fix: corrected partial status mapping

* feat: init unit test for status
  • Loading branch information
davidruvolo51 authored Mar 20, 2024
1 parent 1625ce1 commit ed881ff
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ const props = withDefaults(
<ul class="list-none [&_li]:flex [&_li]:gap-1">
<li>
<HarmonizationStatusIcon size="small" status="complete" />
<span>Completed</span>
<span
>cohort was able to fully map to the harmonized variables</span
>Completed: cohort was able to fully map to the harmonized
variables</span
>
</li>
<li>
<HarmonizationStatusIcon size="small" status="partial" />
<span>Partial</span>
<span
>cohort was able to partially map to the harmonized variable</span
>Partial: cohort was able to partially map to the harmonized
variable</span
>
</li>
<li>
Expand All @@ -55,8 +55,7 @@ const props = withDefaults(
status="unmapped"
class="bg-white"
/>
<span>No data</span>
<span>no harmonization information is available</span>
<span>No data: no harmonization information is available</span>
</li>
</ul>
</template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,18 @@ const props = withDefaults(
<ul class="list-none [&_li]:flex [&_li]:gap-1">
<li>
<HarmonizationStatusIcon size="small" status="available" />
<span>Available</span>
<span>cohort has data available for the variable</span>
<span>Available: cohort has data available for the variable</span>
</li>
<li>
<HarmonizationStatusIcon
size="small"
status="unmapped"
class="bg-white"
/>
<span>No data</span>
<span>cohort does not have data available for the variable</span>
<span
>No data: cohort does not have data available for the
variable</span
>
</li>
</ul>
</template>
Expand Down
2 changes: 1 addition & 1 deletion apps/nuxt3-ssr/utils/harmonization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const calcStatusForSingleVariable = (
case "na":
return "unmapped";
case "partial":
return "complete";
return "partial";
case "complete":
return "complete";
default:
Expand Down
24 changes: 24 additions & 0 deletions e2e/tests/catalogue/variables-details-statuses.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* Harmonization details test
* Determine if the first status in the table has a valid status
*/

import { test, expect } from '@playwright/test';

const enableRejectCookiesClick = false;

const statusPatterns = new RegExp(/^(complete|partial|unmapped)$/);

test('harmonization cell has valid status @variables-view @harmonization @harmonization-matrix', async ({ page }) => {
await page.goto('/catalogue-demo/ssr-catalogue/ATHLETE/variables/ath_ndvi100_mean_0-ATHLETE_CDM-urban_ath-ATHLETE_CDM?keys={"name":"ath_ndvi100_mean_0","resource":{"id":"ATHLETE_CDM"},"dataset":{"name":"urban_ath","resource":{"id":"ATHLETE_CDM"}}}');

if (enableRejectCookiesClick) {
await page.getByRole('button', { name: 'Reject' }).click();
}

const firstCellStatus = await page.locator('tr:nth-child(2) > td > .z-10 > .absolute > span.sr-only')
.first()
.innerText();

expect(firstCellStatus).toMatch(statusPatterns)
});

0 comments on commit ed881ff

Please sign in to comment.