Skip to content

Commit

Permalink
Update TextBuilderTest.php
Browse files Browse the repository at this point in the history
  • Loading branch information
kawax committed Nov 24, 2024
1 parent 00d866d commit 7030fc5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/Feature/RichText/TextBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,20 @@ public function test_detect_facets_link()
$this->assertSame(55, data_get($builder->facets, '2.index.byteStart'));
$this->assertSame(72, data_get($builder->facets, '2.index.byteEnd'));

$this->assertSame(['https://localhost', 'https://localhost/?test=a', 'https://localhost','https://example.com', 'https://localhost/', 'https://localhost/#hash'], collect($builder->facets)->pluck('features.0.uri')->toArray());
$this->assertSame(['https://localhost', 'https://localhost/?test=a', 'https://localhost', 'https://example.com', 'https://localhost/', 'https://localhost/#hash'], collect($builder->facets)->pluck('features.0.uri')->toArray());
}

public function test_detect_facets_tag()
{
$builder = TextBuilder::make('#test #a_ #ゑ #ん #ü #_ #😇 #')->detectFacets();
$builder = TextBuilder::make('#test #a_ #ゑ ん #ü #_ #😇 #')->detectFacets();

$this->assertIsArray($builder->facets);
$this->assertSame(0, data_get($builder->facets, '0.index.byteStart'));
$this->assertSame(5, data_get($builder->facets, '0.index.byteEnd'));
$this->assertSame(10, data_get($builder->facets, '2.index.byteStart'));
$this->assertSame(14, data_get($builder->facets, '2.index.byteEnd'));
$this->assertSame(15, data_get($builder->facets, '3.index.byteStart'));
$this->assertSame(21, data_get($builder->facets, '3.index.byteEnd'));

$this->assertSame(['test', 'a', '', '', 'ü', '😇'], collect($builder->facets)->pluck('features.0.tag')->toArray());
}
Expand Down

0 comments on commit 7030fc5

Please sign in to comment.