From 9bdd945b625d09654356f8846786841d516ea2fb Mon Sep 17 00:00:00 2001 From: Hugh Messenger Date: Mon, 2 Sep 2024 17:39:32 -0500 Subject: [PATCH 1/2] Use assertEqualsCanonicalized() for summary testing --- packages/tables/docs/12-testing.md | 2 ++ packages/tables/src/Testing/TestsSummaries.php | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/tables/docs/12-testing.md b/packages/tables/docs/12-testing.md index 62a7be4eb1..aadf153276 100644 --- a/packages/tables/docs/12-testing.md +++ b/packages/tables/docs/12-testing.md @@ -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 diff --git a/packages/tables/src/Testing/TestsSummaries.php b/packages/tables/src/Testing/TestsSummaries.php index 27cdc9b4a0..042c1f4c45 100644 --- a/packages/tables/src/Testing/TestsSummaries.php +++ b/packages/tables/src/Testing/TestsSummaries.php @@ -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.", @@ -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.", From b9a35cd2a72010b134aef84f4e36e5bcfb639ff4 Mon Sep 17 00:00:00 2001 From: Dan Harrin Date: Tue, 3 Sep 2024 10:18:55 +0100 Subject: [PATCH 2/2] Update packages/tables/docs/12-testing.md --- packages/tables/docs/12-testing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/tables/docs/12-testing.md b/packages/tables/docs/12-testing.md index aadf153276..5024737623 100644 --- a/packages/tables/docs/12-testing.md +++ b/packages/tables/docs/12-testing.md @@ -638,7 +638,7 @@ 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']. +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: