-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Made changes to upgrade the libraries #12
Conversation
@@ -210,7 +213,7 @@ public function whenTryToFindNewXpathButNotFoundItShouldLogItAndResetVariant(): | |||
Log::shouldReceive('warning') | |||
->with("Field ':field-2:' with value ':value-2:' not found for ':scrape-url:'."); | |||
|
|||
$this->expectsEvents(ConfigurationScraped::class); | |||
Event::assertNotDispatched(ConfigurationScraped::class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should expect the event to be dispatched. This issue is repeated bellow a few times and in other tests.
@@ -112,18 +115,20 @@ public function whenIsCalculatedItShouldReturnExtractedDataAndStoreTheNewConfig( | |||
Log::getFacadeRoot() | |||
); | |||
|
|||
$this->expectsEvents(Scraped::class); | |||
// $this->expectsEvents(Scraped::class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid to leave dead code as comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
$configureScraper->handle(new InvalidConfiguration(new ScrapeRequest($this->url, $this->type))); | ||
|
||
/** @var Scraped $event */ | ||
$event = collect($this->firedEvents)->filter(function ($event): bool { | ||
$firedEvents = collect(Event::dispatched(Scraped::class)); | ||
$event = $firedEvents->each(function ($event) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the purpose of these iterations? The same happens in the next test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unwanted code. Removed it.
@@ -63,10 +60,11 @@ public function whenDatasetExistsItShouldBeUpdated(): void | |||
*/ | |||
public function whenDatasetDoesNotExistAndTheDatasetsLimitHasNotBeenReachedItShouldBeSaved(): void | |||
{ | |||
factory(ScrapedDataset::class, UpdateDataset::DATASET_AMOUNT_LIMIT - 1)->create([ | |||
ScrapedDataset::factory()->count(UpdateDataset::DATASET_AMOUNT_LIMIT - 1)->create([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I like the count usage here. Could you change in the other tests to use factory->count($amount)
instead of use factory($amount)
to be consistent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes have been at all places. Can you please which is missing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can find it searching in this pr something like factory(<something>)
@@ -101,7 +99,7 @@ public function whenDatasetDoesNotExistAndTheDatasetsLimitHasNotBeenReachedItSho | |||
public function whenDatasetDoesNotExistAndTheDatasetsLimitHasReachedItShouldDeleteTheExcess(): void | |||
{ | |||
$type = ':type:'; | |||
factory(ScrapedDataset::class, UpdateDataset::DATASET_AMOUNT_LIMIT + 10)->create([ | |||
ScrapedDataset::factory()->count(UpdateDataset::DATASET_AMOUNT_LIMIT)->create([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change in behavior? Is the test testing what it is supposed after this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are inserting the 100 records and testing below in the function with assertion that the number of records fetched are equal to the number of records stored.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test should fulfill the purpose described in the test name. In this case DeleteTheExcess
.
Reopened |
No description provided.