Merge remote-tracking branch 'origin/next' into improve-application-url-handling

This commit is contained in:
Andras Bacsai committed 2026-07-02 17:40:31 +02:00
commit cc4f666ba2
5 files changed
+99 -27

No files matched your search

+37 -17
View File
@@ -56,7 +56,7 @@ it('filters production environment variables by key case-insensitively', functio
->toBe(['API_KEY']);
});
it('treats production environment variable search wildcards literally', function () {
it('treats production environment variable search underscore wildcards literally', function () {
$application = Application::factory()->create([
'environment_id' => $this->environment->id,
]);
@@ -75,23 +75,11 @@ it('treats production environment variable search wildcards literally', function
'resourceable_id' => $application->id,
]);
EnvironmentVariable::create([
'key' => 'PERCENT%KEY',
'value' => 'percent-secret',
'resourceable_type' => Application::class,
'resourceable_id' => $application->id,
]);
$component = Livewire::test(All::class, ['resource' => $application])
->set('search', 'api_key');
expect($component->instance()->environmentVariables->pluck('key')->all())
->toBe(['API_KEY']);
$component->set('search', '%KEY');
expect($component->instance()->environmentVariables->pluck('key')->all())
->toBe(['PERCENT%KEY']);
});
it('filters preview environment variables by key case-insensitively', function () {
@@ -142,6 +130,34 @@ YAML,
->toBe(['API_TOKEN']);
});
it('searches service environment variables without requiring preview variables', function () {
$service = Service::factory()->create([
'environment_id' => $this->environment->id,
]);
EnvironmentVariable::create([
'key' => 'API_KEY',
'value' => 'secret',
'resourceable_type' => Service::class,
'resourceable_id' => $service->id,
]);
EnvironmentVariable::create([
'key' => 'DATABASE_URL',
'value' => 'postgres://example',
'resourceable_type' => Service::class,
'resourceable_id' => $service->id,
]);
$component = Livewire::test(All::class, ['resource' => $service])
->set('search', 'api')
->assertSee('Production Environment Variables')
->assertDontSee('Preview Deployments Environment Variables');
expect($component->instance()->environmentVariables->pluck('key')->all())
->toBe(['API_KEY']);
});
it('does not show the empty production message when search only matches hardcoded variables', function () {
$service = Service::factory()->create([
'environment_id' => $this->environment->id,
@@ -155,11 +171,13 @@ services:
YAML,
]);
Livewire::test(All::class, ['resource' => $service])
$component = Livewire::test(All::class, ['resource' => $service])
->set('search', 'api')
->assertSee('Production Environment Variables')
->assertSee('API_TOKEN')
->assertDontSee('No environment variables found.');
expect($component->instance()->hardcodedEnvironmentVariables->pluck('key')->all())
->toBe(['API_TOKEN']);
});
it('keeps developer view unfiltered after searching', function () {
@@ -242,10 +260,12 @@ it('hides the preview section when search filters out all preview variables', fu
'resourceable_id' => $application->id,
]);
Livewire::test(All::class, ['resource' => $application])
$component = Livewire::test(All::class, ['resource' => $application])
->set('search', 'api')
->assertSee('Production Environment Variables')
->assertSee('API_KEY')
->assertDontSee('Preview Deployments Environment Variables')
->assertDontSee('PREVIEW_TOKEN');
expect($component->instance()->environmentVariables->pluck('key')->all())
->toBe(['API_KEY']);
});
@@ -87,3 +87,32 @@ it('renders the service templates last updated hint placeholder', function () {
$view->assertSee('serviceTemplatesLastUpdated');
$view->assertSee('service.templateLastUpdated');
});
it('keeps service template keys for service selection and docs links', function () {
$services = collect((new Select)->loadServices()['services']);
$denoKv = $services->firstWhere('id', 'denoKV');
expect($denoKv)
->not->toBeNull()
->and($denoKv['docsSlug'])->toBe('denokv');
View::share('errors', new ViewErrorBag);
$view = $this->view('livewire.project.new.select', [
'current_step' => 'type',
'environments' => collect(),
]);
$view->assertSee("setType('one-click-service-' + service.id)", false);
$view->assertSee('service.docsSlug || this.extractBaseServiceName(service.name)', false);
});
it('preserves one click service key casing when selecting a service template', function () {
$component = new Select;
$component->servers = collect();
$component->allServers = collect();
$component->setType('one-click-service-denoKV');
expect($component->type)->toBe('one-click-service-denoKV');
});