Skip to content

NOW MANAGED ON CODEBERG

ZIP Imports/Exports: Fixed some lint and test issues

Dan Brown95d62e7f573b
diff --git a/resources/js/components/index.js b/resources/js/components/index.js
index 12c991a51..24e60bd97 100644
--- a/resources/js/components/index.js
+++ b/resources/js/components/index.js
@@ -30,7 +30,7 @@ export {HeaderMobileToggle} from './header-mobile-toggle';
export {ImageManager} from './image-manager';
export {ImagePicker} from './image-picker';
export {ListSortControl} from './list-sort-control';
-export {LoadingButton} from './loading-button';
+export {LoadingButton} from './loading-button.ts';
export {MarkdownEditor} from './markdown-editor';
export {NewUserPassword} from './new-user-password';
export {Notification} from './notification';
diff --git a/resources/js/components/page-comments.js b/resources/js/components/page-comments.js
index 1d6abfe20..63900888a 100644
--- a/resources/js/components/page-comments.js
+++ b/resources/js/components/page-comments.js
@@ -93,7 +93,6 @@ export class PageComments extends Component {
updateCount() {
const count = this.getCommentCount();
- console.log('update count', count, this.container);
this.commentsTitle.textContent = window.$trans.choice(this.countText, count, {count});
}
diff --git a/tests/Exports/ZipImportTest.php b/tests/Exports/ZipImportTest.php
index 3644e9bdc..ad0e6b241 100644
--- a/tests/Exports/ZipImportTest.php
+++ b/tests/Exports/ZipImportTest.php
@@ -168,6 +168,8 @@ class ZipImportTest extends TestCase
$resp->assertRedirect("/import/{$import->id}");
$this->assertFileExists(storage_path($import->path));
$this->assertActivityExists(ActivityType::IMPORT_CREATE);
+
+ ZipTestHelper::deleteZipForImport($import);
}
public function test_import_show_page()
@@ -325,6 +327,8 @@ class ZipImportTest extends TestCase
$resp = $this->followRedirects($resp);
$resp->assertSeeText('The name field is required.');
$resp->assertSeeText('The id must be an integer.');
+
+ ZipTestHelper::deleteZipForImport($import);
}
public function test_run_checks_permissions_on_import()
@@ -340,6 +344,8 @@ class ZipImportTest extends TestCase
$resp = $this->followRedirects($resp);
$resp->assertSeeText('You are lacking the required permissions to create books.');
+
+ ZipTestHelper::deleteZipForImport($import);
}
public function test_run_requires_parent_for_chapter_and_page_imports()
@@ -379,6 +385,8 @@ class ZipImportTest extends TestCase
$resp = $this->followRedirects($resp);
$resp->assertSee('Parent book required for chapter import.');
+
+ ZipTestHelper::deleteZipForImport($import);
}
protected function runImportFromFile(UploadedFile $file): TestResponse
diff --git a/tests/Exports/ZipTestHelper.php b/tests/Exports/ZipTestHelper.php
index 2196f361c..d830d8eb6 100644
--- a/tests/Exports/ZipTestHelper.php
+++ b/tests/Exports/ZipTestHelper.php
@@ -20,7 +20,14 @@ class ZipTestHelper
$import = Import::factory()->create($importData);
$zip = static::zipUploadFromData($zipData, $files);
- rename($zip->getRealPath(), storage_path($import->path));
+ $targetPath = storage_path($import->path);
+ $targetDir = dirname($targetPath);
+
+ if (!file_exists($targetDir)) {
+ mkdir($targetDir);
+ }
+
+ rename($zip->getRealPath(), $targetPath);
return $import;
}