test: cover terminated + blank-coord skip paths for postcodes:import
This commit is contained in:
@@ -31,3 +31,33 @@ CSV;
|
||||
->and(Postcode::find('SW1A1AA')->outcode)->toBe('SW1A')
|
||||
->and(Postcode::find('M11AD')->outcode)->toBe('M1');
|
||||
});
|
||||
|
||||
it('skips terminated postcodes', function (): void {
|
||||
$csv = <<<'CSV'
|
||||
pcd,pcds,doterm,lat,long
|
||||
"SW1A1AA","SW1A 1AA","",51.501009,-0.141588
|
||||
"OLD1AA","OLD 1AA","202301",50.000000,-1.000000
|
||||
CSV;
|
||||
|
||||
$path = writeOnspdFixture($csv);
|
||||
|
||||
$this->artisan('postcodes:import', ['--file' => $path])->assertSuccessful();
|
||||
|
||||
expect(Postcode::count())->toBe(1)
|
||||
->and(Postcode::find('OLD1AA'))->toBeNull();
|
||||
});
|
||||
|
||||
it('skips rows with blank coordinates', function (): void {
|
||||
$csv = <<<'CSV'
|
||||
pcd,pcds,doterm,lat,long
|
||||
"SW1A1AA","SW1A 1AA","",51.501009,-0.141588
|
||||
"BT11AA","BT1 1AA","",,
|
||||
CSV;
|
||||
|
||||
$path = writeOnspdFixture($csv);
|
||||
|
||||
$this->artisan('postcodes:import', ['--file' => $path])->assertSuccessful();
|
||||
|
||||
expect(Postcode::count())->toBe(1)
|
||||
->and(Postcode::find('BT11AA'))->toBeNull();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user