-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[dagit] Fix InstigationTick "Skipped" message if zero runs (#7527)
## Summary Resolves #7274. The "Skipped" tag on instigation tick tags shows an incorrect tooltip when there are no run keys. Just a JS error, the array is always truthy. ## Test Plan Added a jest test.
- Loading branch information
Showing
2 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
js_modules/dagit/packages/core/src/instigation/InstigationTick.test.tsx
This file contains 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,51 @@ | ||
import {render, screen, waitFor} from '@testing-library/react'; | ||
import userEvent from '@testing-library/user-event'; | ||
import * as React from 'react'; | ||
|
||
import {InstigationTickStatus} from '../types/globalTypes'; | ||
|
||
import {TickTag} from './InstigationTick'; | ||
import {TickTagFragment} from './types/TickTagFragment'; | ||
|
||
describe('TickTag', () => { | ||
const tick: TickTagFragment = { | ||
__typename: 'InstigationTick', | ||
id: 'foobar', | ||
status: InstigationTickStatus.SUCCESS, | ||
timestamp: Date.now(), | ||
skipReason: 'lol skipped', | ||
runIds: [], | ||
runKeys: [], | ||
error: null, | ||
}; | ||
|
||
describe('Skipped', () => { | ||
it('renders skip reason if no run keys', async () => { | ||
const skippedTick = {...tick, status: InstigationTickStatus.SKIPPED}; | ||
|
||
render(<TickTag tick={skippedTick} />); | ||
|
||
const tag = screen.queryByText(/skipped/i); | ||
expect(tag).toBeVisible(); | ||
|
||
userEvent.hover(tag as HTMLElement); | ||
await waitFor(() => { | ||
expect(screen.queryByText('lol skipped')).toBeVisible(); | ||
}); | ||
}); | ||
|
||
it('renders info about requested run count if run keys', async () => { | ||
const skippedTick = {...tick, status: InstigationTickStatus.SKIPPED, runKeys: ['foo', 'bar']}; | ||
|
||
render(<TickTag tick={skippedTick} />); | ||
|
||
const tag = screen.queryByText(/skipped/i); | ||
expect(tag).toBeVisible(); | ||
|
||
userEvent.hover(tag as HTMLElement); | ||
await waitFor(() => { | ||
expect(screen.queryByText(/2 runs requested, but skipped/i)).toBeVisible(); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains 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