diff --git a/tests/Unit/BladeDirectiveTest.php b/tests/Unit/BladeDirectiveTest.php
new file mode 100644
index 0000000..800ed5d
--- /dev/null
+++ b/tests/Unit/BladeDirectiveTest.php
@@ -0,0 +1,142 @@
+run();
+
+ $this->app->singleton('aauth', function ($app) {
+ return new \AuroraWebSoftware\AAuth\AAuth(
+ User::find(1),
+ 3
+ );
+ });
+});
+
+test('aauth blade directive compiles correctly', function () {
+ $compiled = Blade::compileString("@aauth('test_permission')");
+
+ expect($compiled)->toContain('');
+});
+
+test('endaauth blade directive compiles correctly', function () {
+ $compiled = Blade::compileString('@endaauth');
+
+ expect($compiled)->toBe('');
+});
+
+test('aauth blade directive with permission renders content when user has permission', function () {
+ $blade = "@aauth('create_something_for_organization')
+
User has permission
+@endaauth";
+
+ $compiled = Blade::compileString($blade);
+ ob_start();
+ eval('?>'.$compiled);
+ $output = ob_get_clean();
+
+ expect(trim($output))->toContain('User has permission');
+});
+
+test('aauth blade directive hides content when user lacks permission', function () {
+ $blade = "@aauth('non_existent_permission')
+ User has permission
+@endaauth";
+
+ $compiled = Blade::compileString($blade);
+ ob_start();
+ eval('?>'.$compiled);
+ $output = ob_get_clean();
+
+ expect(trim($output))->toBe('');
+});
+
+test('aauth blade directive works with single quotes', function () {
+ $blade = "@aauth('create_something_for_organization')
+ Content visible
+@endaauth";
+
+ $compiled = Blade::compileString($blade);
+
+ expect($compiled)->toContain("");
+ expect($compiled)->toContain('');
+});
+
+test('aauth blade directive works with double quotes', function () {
+ $blade = '@aauth("create_something_for_organization")
+ Content visible
+@endaauth';
+
+ $compiled = Blade::compileString($blade);
+
+ expect($compiled)->toContain('');
+ expect($compiled)->toContain('');
+});
+
+test('aauth blade directive works with variable', function () {
+ $blade = '@aauth($permission)
+ Content visible
+@endaauth';
+
+ $compiled = Blade::compileString($blade);
+
+ expect($compiled)->toContain('');
+ expect($compiled)->toContain('');
+});
+
+test('nested aauth blade directives compile correctly', function () {
+ $blade = "@aauth('permission1')
+ Outer content
+ @aauth('permission2')
+ Inner content
+ @endaauth
+@endaauth";
+
+ $compiled = Blade::compileString($blade);
+
+ expect($compiled)->toContain("");
+ expect($compiled)->toContain("");
+});
+
+test('aauth blade directive with html content renders correctly when permitted', function () {
+ $blade = "@aauth('create_something_for_organization')
+
+ Admin Panel
+@endaauth";
+
+ $compiled = Blade::compileString($blade);
+ ob_start();
+ eval('?>'.$compiled);
+ $output = ob_get_clean();
+
+ expect($output)->toContain('')
+ ->and($output)->toContain('Admin Panel');
+});
+
+test('multiple aauth blocks in same template work independently', function () {
+ $blade = "@aauth('create_something_for_organization')
+ First block
+@endaauth
+
+@aauth('non_existent_permission')
+ Second block
+@endaauth
+
+@aauth('create_something_for_organization')
+ Third block
+@endaauth";
+
+ $compiled = Blade::compileString($blade);
+ ob_start();
+ eval('?>'.$compiled);
+ $output = ob_get_clean();
+
+ expect($output)->toContain('First block')
+ ->and($output)->toContain('Third block')
+ ->and($output)->not->toContain('Second block');
+});