From 49885646e5411e788bf3f4dd7fc55806c49b5854 Mon Sep 17 00:00:00 2001 From: Awilum Date: Sun, 22 May 2022 09:58:00 +0300 Subject: [PATCH] feat(tests): improve tests for directives --- .../core/Entries/Directives/CalcDirectiveTest.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/src/flextype/core/Entries/Directives/CalcDirectiveTest.php b/tests/src/flextype/core/Entries/Directives/CalcDirectiveTest.php index 21f12a3d..65cf77ff 100644 --- a/tests/src/flextype/core/Entries/Directives/CalcDirectiveTest.php +++ b/tests/src/flextype/core/Entries/Directives/CalcDirectiveTest.php @@ -11,7 +11,14 @@ afterEach(function (): void { }); test('calc directive', function () { - // (calc:1+1) + registry()->set('flextype.settings.entries.directives.calc.enabled', true); + entries()->create('field', ['foo' => '@type[int] @calc[2+2]']); + expect(entries()->fetch('field')['foo'])->toBe(4); +}); + +test('calc directive disabled', function () { + registry()->set('flextype.settings.entries.directives.calc.enabled', false); entries()->create('field', ['foo' => '@calc[2+2]']); - $this->assertEquals(4, entries()->fetch('field')['foo']); + expect(entries()->fetch('field')['foo'])->toBe('@calc[2+2]'); + registry()->set('flextype.settings.entries.directives.calc.enabled', true); }); \ No newline at end of file