Skip to content

Commit

Permalink
refactor tests
Browse files Browse the repository at this point in the history
  • Loading branch information
susantp committed Dec 17, 2023
1 parent 18380ce commit 4e1d34a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/Feature/QuestionTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Database\Seeders\CourseSeeder;
use Database\Seeders\Questionnaire\AssessmentSeeder;
use Database\Seeders\Questionnaire\ModuleSeeder;
use Illuminate\Support\Str;

uses()->group('questionnaire-crud');
beforeEach(function () {
Expand Down Expand Up @@ -52,9 +53,16 @@
expect($questionTrueFalseUpdate)->answer->toBe($questionTrueFalseCreateData->answer);
});
it('can create/update describe image question', function () {

$question = Question::factory()->create();
$questionDescribeImageData = QuestionDescribeImageData::from([
'image_path' => 'some-path.jpg',
'questions' => [
['id' => Str::uuid(), 'body' => 'question 1'],
['id' => Str::uuid(), 'body' => 'question 2'],
['id' => Str::uuid(), 'body' => 'question 3'],
['id' => Str::uuid(), 'body' => 'question 4'],
],
]);
$questionDescribeImageCreate = QuestionnaireAdmin::createQuestionDescribeImage($question, $questionDescribeImageData);
//create
Expand All @@ -64,6 +72,12 @@
->image_path->toBe($questionDescribeImageData->image_path);
$questionDescribeImageData = QuestionDescribeImageData::from([
'image_path' => 'another-path.jpg',
'questions' => [
['id' => Str::uuid(), 'body' => 'question 1'],
['id' => Str::uuid(), 'body' => 'question 2'],
['id' => Str::uuid(), 'body' => 'question 3'],
['id' => Str::uuid(), 'body' => 'question 4'],
],
]);
$questionDescribeImageUpdate = QuestionnaireAdmin::updateQuestionDescribeImage($question, $questionDescribeImageData);
//update
Expand Down

0 comments on commit 4e1d34a

Please sign in to comment.