rules())->errors()->toArray(); } it('requires a name and desired_replicas', function () { $errors = validateUpdate([]); expect($errors)->toHaveKey('name'); expect($errors)->toHaveKey('desired_replicas'); }); it('rejects desired_replicas above the cap', function () { $errors = validateUpdate([ 'name' => 'web', 'desired_replicas' => 26, ]); expect($errors)->toHaveKey('desired_replicas'); }); it('rejects a default cpu limit above the cap', function () { $errors = validateUpdate([ 'name' => 'web', 'desired_replicas' => 1, 'default_cpu_limit' => 65, ]); expect($errors)->toHaveKey('default_cpu_limit'); }); it('rejects a default memory limit below the floor', function () { $errors = validateUpdate([ 'name' => 'web', 'desired_replicas' => 1, 'default_memory_limit_mb' => 32, ]); expect($errors)->toHaveKey('default_memory_limit_mb'); }); it('accepts a valid payload', function () { $errors = validateUpdate([ 'name' => 'web', 'desired_replicas' => 3, 'default_cpu_limit' => 1.5, 'default_memory_limit_mb' => 512, ]); expect($errors)->toBeEmpty(); }); it('authorises the request', function () { expect((new UpdateServiceRequest)->authorize())->toBeTrue(); });