mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Expand test coverage.
This commit is contained in:
@@ -191,6 +191,43 @@ class IndexControllerTest extends TestCase
|
||||
$response->assertRedirect(route('import.job.configuration.index', ['file_job_1']));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Import\IndexController
|
||||
*/
|
||||
public function testDownload(): void
|
||||
{
|
||||
// mock stuff:
|
||||
$repository = $this->mock(ImportJobRepositoryInterface::class);
|
||||
$userRepository = $this->mock(UserRepositoryInterface::class);
|
||||
$fakePrerequisites = $this->mock(FakePrerequisites::class);
|
||||
$bunqPrerequisites = $this->mock(BunqPrerequisites::class);
|
||||
$spectrePrerequisites = $this->mock(SpectrePrerequisites::class);
|
||||
$filePrerequisites = $this->mock(FilePrerequisites::class);
|
||||
|
||||
$job = new ImportJob;
|
||||
$job->user_id = $this->user()->id;
|
||||
$job->key = 'dc_' . random_int(1, 1000);
|
||||
$job->status = 'ready_to_run';
|
||||
$job->stage = 'go-for-import';
|
||||
$job->provider = 'file';
|
||||
$job->file_type = '';
|
||||
$job->configuration = [];
|
||||
$job->save();
|
||||
|
||||
$fakeConfig = [
|
||||
'hi' => 'there',
|
||||
1 => true,
|
||||
'column-mapping-config' => ['a', 'b', 'c'],
|
||||
];
|
||||
|
||||
$repository->shouldReceive('getConfiguration')->andReturn($fakeConfig)->once();
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('import.job.download', [$job->key]));
|
||||
$response->assertStatus(200);
|
||||
$response->assertExactJson(['column-mapping-config' => [], 'delimiter' => ',', 'hi' => 'there', 1 => true]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Http\Controllers\Import\IndexController
|
||||
*/
|
||||
|
@@ -80,7 +80,7 @@ class JobStatusControllerTest extends TestCase
|
||||
$job->user_id = $this->user()->id;
|
||||
$job->key = 'Bfake_job_' . random_int(1, 1000);
|
||||
$job->status = 'ready_to_run';
|
||||
$job->provider = 'fake';
|
||||
$job->provider = 'file';
|
||||
$job->transactions = [];
|
||||
$job->file_type = '';
|
||||
$job->save();
|
||||
|
Reference in New Issue
Block a user