Skip to content

Commit

Permalink
[dagit] Fix warning icon tests, add one for present-but-stopped sched…
Browse files Browse the repository at this point in the history
…ule (#7026)
  • Loading branch information
bengotow committed Mar 11, 2022
1 parent 64033df commit 02524aa
Showing 1 changed file with 21 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,25 @@ describe('InstanceWarningIcon', () => {
});
});

it('displays if there are schedules, and only a scheduler error', async () => {
it('does not display if schedules are not enabled, and only a scheduler error', async () => {
const pipelineMocks = {
Pipeline: () => ({
sensors: () => [],
schedules: () => [...new Array(1)],
schedules: () => [{scheduleState: {status: 'STOPPED'}}],
}),
};

render(<Test mocks={[defaultMocks, scheduleErrorMocks, pipelineMocks]} />);
await waitFor(() => {
expect(screen.queryByLabelText('warning')).toBeNull();
});
});

it('displays if there are running schedules, and only a scheduler error', async () => {
const pipelineMocks = {
Pipeline: () => ({
sensors: () => [],
schedules: () => [{scheduleState: {status: 'RUNNING'}}],
}),
};

Expand Down Expand Up @@ -117,7 +131,7 @@ describe('InstanceWarningIcon', () => {
it('displays if there are sensors, and only a sensor error', async () => {
const pipelineMocks = {
Pipeline: () => ({
sensors: () => [...new Array(1)],
sensors: () => [{sensorState: {status: 'RUNNING'}}],
schedules: () => [],
}),
};
Expand Down Expand Up @@ -157,7 +171,7 @@ describe('InstanceWarningIcon', () => {
it('displays if there are sensors, and only (both) sensor/schedule errors', async () => {
const pipelineMocks = {
Pipeline: () => ({
sensors: () => [...new Array(1)],
sensors: () => [{sensorState: {status: 'RUNNING'}}],
schedules: () => [],
}),
};
Expand All @@ -172,7 +186,7 @@ describe('InstanceWarningIcon', () => {
const pipelineMocks = {
Pipeline: () => ({
sensors: () => [],
schedules: () => [...new Array(1)],
schedules: () => [{scheduleState: {status: 'RUNNING'}}],
}),
};

Expand All @@ -185,8 +199,8 @@ describe('InstanceWarningIcon', () => {
it('displays if there are schedules and sensors, and only (both) sensor/schedule errors', async () => {
const pipelineMocks = {
Pipeline: () => ({
sensors: () => [...new Array(1)],
schedules: () => [...new Array(1)],
sensors: () => [{sensorState: {status: 'RUNNING'}}],
schedules: () => [{scheduleState: {status: 'RUNNING'}}],
}),
};

Expand Down

0 comments on commit 02524aa

Please sign in to comment.