Skip to content

Commit

Permalink
Change tests to Pest
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmitjoo authored Sep 30, 2024
1 parent f23e8f6 commit 5a563b8
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions tests/HasTagsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -351,25 +351,23 @@
});

it('can check if it has a tag', function () {
$model = TestModel::create(['name' => 'test model']);
$tag = Tag::findOrCreate('test-tag');
$anotherTag = Tag::findOrCreate('another-tag');

$model->attachTag($tag);
$this->testModel->attachTag($tag);

$this->assertTrue($model->hasTag('test-tag'));
$this->assertTrue($model->hasTag($tag->id));
$this->assertFalse($model->hasTag('non-existing-tag'));
$this->assertFalse($model->hasTag($anotherTag->id));
expect($this->testModel->hasTag('test-tag'))->toBeTrue();
expect($this->testModel->hasTag($tag->id))->toBeTrue();
expect($this->testModel->hasTag('non-existing-tag'))->toBeFalse();
expect($this->testModel->hasTag($anotherTag->id))->toBeFalse();
});

it('can check if it has a tag with type', function () {
$model = TestModel::create(['name' => 'test model']);
$tag = Tag::findOrCreate('test-tag', 'type1');
$sameNameDifferentType = Tag::findOrCreate('test-tag', 'type2');

$model->attachTag($tag);
$this->testModel->attachTag($tag);

$this->assertTrue($model->hasTag('test-tag', 'type1'));
$this->assertFalse($model->hasTag('test-tag', 'type2'));
expect($this->testModel->hasTag('test-tag', 'type1'))->toBeTrue();
expect($this->testModel->hasTag('test-tag', 'type2'))->toBeFalse();
});

0 comments on commit 5a563b8

Please sign in to comment.