+ public function test_drawing_base64_upload_with_svg()
+ {
+ $page = Page::first();
+ $editor = $this->getEditor();
+ $this->actingAs($editor);
+
+ $upload = $this->postJson('images/drawio', [
+ 'uploaded_to' => $page->id,
+ 'image' => 'data:image/svg+xml;base64,' . base64_encode(file_get_contents($this->getTestImageFilePath('diagram.svg'))),
+ ]);
+
+ $upload->assertStatus(200);
+ $upload->assertJson([
+ 'type' => 'drawio',
+ 'uploaded_to' => $page->id,
+ 'created_by' => $editor->id,
+ 'updated_by' => $editor->id,
+ ]);
+
+ $image = Image::where('type', '=', 'drawio')->first();
+ $this->assertStringEndsWith('.svg', $image->path);
+ $this->assertTrue(file_exists(public_path($image->path)), 'Uploaded image not found at path: ' . public_path($image->path));
+
+ $testImageData = file_get_contents($this->getTestImageFilePath('diagram.svg'));
+ $uploadedImageData = file_get_contents(public_path($image->path));
+ $this->assertTrue($testImageData === $uploadedImageData, 'Uploaded image file data does not match our test image as expected');
+ }
+