Skip to content

Commit 46b4c6c

Browse files
committed
wip
1 parent 4c2cf23 commit 46b4c6c

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

tests/CsvImporterTest.php

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
});
2424

2525
it('renders import CSV component with model and file', function () {
26-
Storage::fake('documents');
26+
Storage::fake();
2727

2828
$path = __DIR__.DIRECTORY_SEPARATOR.'stubs'.DIRECTORY_SEPARATOR.'customers.csv';
2929
$model = Customer::class;
@@ -34,12 +34,13 @@
3434
livewire(CsvImporter::class, [
3535
'model' => $model,
3636
])
37-
->set('file', $file)
37+
->set('file', $path)
3838
->assertSet('model', $model)
3939
->assertSuccessful();
4040
});
4141

4242
it('throws a validation error if the csv file empty', function () {
43+
Storage::fake();
4344
$model = Customer::class;
4445

4546
$file = UploadedFile::fake()
@@ -51,14 +52,15 @@
5152
livewire(CsvImporter::class, [
5253
'model' => $model,
5354
])
54-
->set('file', $file)
55-
->assertSet('model', $model)
56-
->assertHasErrors(['file']);
55+
->set('file', $file)
56+
->assertSet('model', $model)
57+
->assertHasErrors(['file']);
5758
});
5859

5960
it('throws a validation error if the csv file has duplicate headers', function () {
60-
$model = Customer::class;
61+
Storage::fake();
6162

63+
$model = Customer::class;
6264
$file = UploadedFile::fake()
6365
->createWithContent(
6466
'customers.csv',
@@ -68,9 +70,9 @@
6870
livewire(CsvImporter::class, [
6971
'model' => $model,
7072
])
71-
->set('file', $file)
72-
->assertSet('model', $model)
73-
->assertHasErrors(['file']);
73+
->set('file', $file)
74+
->assertSet('model', $model)
75+
->assertHasErrors(['file']);
7476
});
7577

7678
it('transfers columnsToMap into an associative array', function () {

0 commit comments

Comments
 (0)