|
23 | 23 | });
|
24 | 24 |
|
25 | 25 | it('renders import CSV component with model and file', function () {
|
26 |
| - Storage::fake('documents'); |
| 26 | + Storage::fake(); |
27 | 27 |
|
28 | 28 | $path = __DIR__.DIRECTORY_SEPARATOR.'stubs'.DIRECTORY_SEPARATOR.'customers.csv';
|
29 | 29 | $model = Customer::class;
|
|
34 | 34 | livewire(CsvImporter::class, [
|
35 | 35 | 'model' => $model,
|
36 | 36 | ])
|
37 |
| - ->set('file', $file) |
| 37 | + ->set('file', $path) |
38 | 38 | ->assertSet('model', $model)
|
39 | 39 | ->assertSuccessful();
|
40 | 40 | });
|
41 | 41 |
|
42 | 42 | it('throws a validation error if the csv file empty', function () {
|
| 43 | + Storage::fake(); |
43 | 44 | $model = Customer::class;
|
44 | 45 |
|
45 | 46 | $file = UploadedFile::fake()
|
|
51 | 52 | livewire(CsvImporter::class, [
|
52 | 53 | 'model' => $model,
|
53 | 54 | ])
|
54 |
| - ->set('file', $file) |
55 |
| - ->assertSet('model', $model) |
56 |
| - ->assertHasErrors(['file']); |
| 55 | + ->set('file', $file) |
| 56 | + ->assertSet('model', $model) |
| 57 | + ->assertHasErrors(['file']); |
57 | 58 | });
|
58 | 59 |
|
59 | 60 | it('throws a validation error if the csv file has duplicate headers', function () {
|
60 |
| - $model = Customer::class; |
| 61 | + Storage::fake(); |
61 | 62 |
|
| 63 | + $model = Customer::class; |
62 | 64 | $file = UploadedFile::fake()
|
63 | 65 | ->createWithContent(
|
64 | 66 | 'customers.csv',
|
|
68 | 70 | livewire(CsvImporter::class, [
|
69 | 71 | 'model' => $model,
|
70 | 72 | ])
|
71 |
| - ->set('file', $file) |
72 |
| - ->assertSet('model', $model) |
73 |
| - ->assertHasErrors(['file']); |
| 73 | + ->set('file', $file) |
| 74 | + ->assertSet('model', $model) |
| 75 | + ->assertHasErrors(['file']); |
74 | 76 | });
|
75 | 77 |
|
76 | 78 | it('transfers columnsToMap into an associative array', function () {
|
|
0 commit comments