Просмотр исходного кода

Added: tests for field-details render

James Doyle 3 лет назад
Родитель
Сommit
8181b6efb1
2 измененных файлов с 35 добавлено и 0 удалено
  1. 1 0
      phpunit.xml
  2. 34 0
      tests/Unit/FieldRenderTest.php

+ 1 - 0
phpunit.xml

@@ -44,6 +44,7 @@
         </testsuite>
         <testsuite name="Unit Tests 4">
             <file>tests/Unit/ValidationRuleParsingTest.php</file>
+            <file>tests/Unit/FieldRenderTest.php</file>
         </testsuite>
     </testsuites>
 </phpunit>

+ 34 - 0
tests/Unit/FieldRenderTest.php

@@ -0,0 +1,34 @@
+<?php
+
+namespace Knuckles\Scribe\Tests\Unit;
+
+use Knuckles\Scribe\Tests\BaseLaravelTest;
+use Illuminate\Foundation\Testing\Concerns\InteractsWithViews;
+
+class FieldRenderTest extends BaseLaravelTest
+{
+    use InteractsWithViews;
+
+    /** @test */
+    public function can_render_a_field_with_an_example_value()
+    {
+        $data = [
+            'name' => 'Parameter Name',
+            'description' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod.',
+            'example' => 'My Custom Value',
+            'endpointId' => 'example-requests-GET',
+        ];
+
+        $view = $this->view(
+            'scribe::components.field-details', array_merge($data, [
+                'type' => 'string',
+                'required' => true,
+                'component' => 'url',
+            ])
+        );
+
+        foreach ($data as $text) {
+            $view->assertSee($text);
+        }
+    }
+}