Skip to content

Commit

Permalink
More tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mariosimao committed May 6, 2023
1 parent 4abd7cb commit dbbd86b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
3 changes: 1 addition & 2 deletions tests/Unit/Blocks/ToggleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Notion\Test\Unit\Blocks;

use Notion\Blocks\BlockFactory;
use Notion\Blocks\ToDo;
use Notion\Exceptions\BlockException;
use Notion\Blocks\Toggle;
use Notion\Common\Color;
Expand Down Expand Up @@ -190,7 +189,7 @@ public function test_add_child(): void

public function test_change_color(): void
{
$block = ToDo::fromString("Hello World!")->changeColor(Color::Red);
$block = Toggle::fromString("Hello World!")->changeColor(Color::Red);

$this->assertSame(Color::Red, $block->color);
}
Expand Down
11 changes: 11 additions & 0 deletions tests/Unit/Databases/DatabaseParentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,17 @@ public function test_workspace_array_conversion(): void
$this->assertEquals($array["workspace"], $parent->toArray()["workspace"]);
}

public function test_block_array_conversion(): void
{
$array = [
"type" => "block_id",
"block_id" => "7a774b5d-ca74-4679-9f18-689b5a98f138",
];
$parent = DatabaseParent::fromArray($array);

$this->assertEquals($array["block_id"], $parent->toArray()["block_id"]);
}

public function test_invalid_type_array(): void
{
$this->expectException(\ValueError::class);
Expand Down
11 changes: 11 additions & 0 deletions tests/Unit/Pages/PageParentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,17 @@ public function test_workspace_array_conversion(): void
$this->assertEquals($array["workspace"], $parent->toArray()["workspace"]);
}

public function test_block_array_conversion(): void
{
$array = [
"type" => "block_id",
"block_id" => "7a774b5d-ca74-4679-9f18-689b5a98f138",
];
$parent = PageParent::fromArray($array);

$this->assertEquals($array["block_id"], $parent->toArray()["block_id"]);
}

public function test_invalid_type_array(): void
{
$this->expectException(\ValueError::class);
Expand Down
1 change: 1 addition & 0 deletions tests/Unit/Pages/Properties/DateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,6 @@ public function test_is_empty(): void
$date = Date::fromArray($array);

$this->assertTrue($date->isEmpty());
$this->assertFalse($date->isRange());
}
}

0 comments on commit dbbd86b

Please sign in to comment.