Skip to content

Commit

Permalink
Merge pull request #14124 from cheesegrits/3.x-summary-test
Browse files Browse the repository at this point in the history
Use assertEqualsCanonicalized() for summary testing
  • Loading branch information
danharrin authored Sep 3, 2024
2 parents 66a53f3 + b9a35cd commit ea87f9a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions packages/tables/docs/12-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,8 @@ it('can average values in a column', function () {

The first argument is the column name, the second is the summarizer ID, and the third is the expected value.

Note that the expected and actual values are normalized, such that `123.12` is considered the same as `"123.12"`, and `['Fred', 'Jim']` is the same as `['Jim', 'Fred']`.

You may set a summarizer ID by passing it to the `make()` method:

```php
Expand Down
4 changes: 2 additions & 2 deletions packages/tables/src/Testing/TestsSummaries.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function assertTableColumnSummarySet(): Closure

$livewireClass = $this->instance()::class;

Assert::assertSame(
Assert::assertEqualsCanonicalizing(
$state,
$actualState,
message: "Failed asserting that summarizer [$summarizerId], for column [{$columnName}], on the [{$livewireClass}] component, is set.",
Expand Down Expand Up @@ -73,7 +73,7 @@ public function assertTableColumnSummaryNotSet(): Closure

$livewireClass = $this->instance()::class;

Assert::assertNotSame(
Assert::assertNotEqualsCanonicalizing(
$state,
$actualState,
message: "Failed asserting that summarizer [$summarizerId], for column [{$columnName}], on the [{$livewireClass}] component, is not set.",
Expand Down

0 comments on commit ea87f9a

Please sign in to comment.