<?php

declare(strict_types=1);

use Builder\Core\Support\Module;

it('has() returns false when key is not bound', function (): void {
    expect(Module::has('not-bound-key-xyz'))->toBeFalse();
});

it('has() returns true when key is bound', function (): void {
    app()->bind('builder.test-module', fn (): string => 'test');

    expect(Module::has('test-module'))->toBeTrue();
});

it('when() returns empty array when module is not active', function (): void {
    expect(Module::when('not-bound-key-xyz', ['field1', 'field2']))->toBe([]);
});

it('when() returns the provided fields array when module is active', function (): void {
    app()->bind('builder.active-module', fn (): string => 'active');

    expect(Module::when('active-module', ['field1', 'field2']))->toBe(['field1', 'field2']);
});
