@playpilot/tpi 8.36.1 → 8.36.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playpilot/tpi",
3
- "version": "8.36.1",
3
+ "version": "8.36.2",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite dev",
@@ -77,7 +77,7 @@
77
77
  <div class="jobs">
78
78
  {#each ['all', ...participant.jobs] as job}
79
79
  <Button variant="border" size="large" active={currentJob === job} onclick={() => currentJob = job as 'all' | Job}>
80
- {t('Job: ' + job)}
80
+ {t('Job: ' + job).replace('Job: ', '')}
81
81
  </Button>
82
82
  {/each}
83
83
  </div>
@@ -186,5 +186,9 @@
186
186
  flex-wrap: wrap;
187
187
  gap: margin(0.5);
188
188
  margin-bottom: margin(0.5);
189
+
190
+ :global(.button) {
191
+ text-transform: capitalize;
192
+ }
189
193
  }
190
194
  </style>
@@ -90,6 +90,16 @@ describe('Participant.svelte', () => {
90
90
  })
91
91
  })
92
92
 
93
+ it('Should render jobs without translations without prefix', async () => {
94
+ const resolved = ({ results: Array(30).fill(title), next: 'next', previous: 'previous' })
95
+ vi.mocked(fetchTitles).mockResolvedValueOnce(resolved)
96
+
97
+ // @ts-ignore
98
+ const { getByText } = render(Participant, { participant: { ...participants[0], jobs: ['unknown'] } })
99
+
100
+ expect(getByText('unknown')).toBeTruthy()
101
+ })
102
+
93
103
  it('Should include selected sorting specific to participants', async () => {
94
104
  const resolved = ({ results: Array(30).fill(title), next: 'next', previous: 'previous' })
95
105
  vi.mocked(fetchTitles).mockResolvedValueOnce(resolved)
@@ -6,7 +6,7 @@ import { openModal } from '$lib/modal'
6
6
  import { participants, title } from '$lib/fakeData'
7
7
  import { track } from '$lib/tracking'
8
8
  import { TrackingEvent } from '$lib/enums/TrackingEvent'
9
- import { fetchParticipantsForTitle } from '$lib/api/participants'
9
+ import { fetchParticipantBySid, fetchParticipantsForTitle } from '$lib/api/participants'
10
10
 
11
11
  vi.mock('$lib/modal', () => ({
12
12
  openModal: vi.fn(),
@@ -18,6 +18,7 @@ vi.mock('$lib/tracking', () => ({
18
18
 
19
19
  vi.mock('$lib/api/participants', () => ({
20
20
  fetchParticipantsForTitle: vi.fn(),
21
+ fetchParticipantBySid: vi.fn(),
21
22
  }))
22
23
 
23
24
  describe('ParticipantsRail.svelte', () => {
@@ -76,8 +77,9 @@ describe('ParticipantsRail.svelte', () => {
76
77
  })
77
78
  })
78
79
 
79
- it('Should open modal on click of participant', async () => {
80
+ it('Should fetch participant and open modal on click of participant', async () => {
80
81
  vi.mocked(fetchParticipantsForTitle).mockResolvedValueOnce(participants)
82
+ vi.mocked(fetchParticipantBySid).mockResolvedValueOnce(participants[0])
81
83
 
82
84
  const { getAllByTestId } = render(ParticipantsRail, { title })
83
85
 
@@ -85,7 +87,10 @@ describe('ParticipantsRail.svelte', () => {
85
87
  await fireEvent.click(getAllByTestId('participant')[0])
86
88
  })
87
89
 
88
- expect(openModal).toHaveBeenCalledWith({ event: expect.any(Object), type: 'participant', data: participants[0] })
90
+ await waitFor(async () => {
91
+ expect(fetchParticipantBySid).toHaveBeenCalledWith(participants[0].sid)
92
+ expect(openModal).toHaveBeenCalledWith({ event: expect.any(Object), type: 'participant', data: participants[0] })
93
+ })
89
94
  })
90
95
 
91
96
  it('Should not open modal on click if if open_tpi_links_in_explore is true and instead set url', async () => {