diff --git a/tests/Feature/MonitoringTest.php b/tests/Feature/MonitoringTest.php index 60f1c570..4b4603cf 100644 --- a/tests/Feature/MonitoringTest.php +++ b/tests/Feature/MonitoringTest.php @@ -64,4 +64,18 @@ public function test_completed_jobs_are_removed_from_database_when_their_tag_is_ dispatch(new StopMonitoringTag('first')); $this->assertEquals(0, $this->monitoredJobs('first')); } + + public function test_all_completed_jobs_are_removed_from_database_when_their_tag_is_no_longer_monitored() + { + dispatch(new MonitorTag('first')); + + for ($i = 0; $i < 80; $i++) { + Queue::push(new Jobs\BasicJob); + } + + $this->work(); + + dispatch(new StopMonitoringTag('first')); + $this->assertEquals(0, $this->monitoredJobs('first')); + } }