Skip to content

Commit

Permalink
testing the deduplication.
Browse files Browse the repository at this point in the history
  • Loading branch information
robertbrowncc committed Apr 22, 2024
1 parent 5917961 commit 26b96fe
Showing 1 changed file with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,29 @@ public function it_should_store_multiple_submissions_created_by_factory(): void
$this->assertCount(15, Statement::all());
}

/**
* @test
*/
public function it_should_deduplicate_territories(): void
{
$user = $this->signInAsContributor();

$statements = $this->createFullStatements(5);
$statements[4]['territorial_scope'] = ['DE', 'ES', 'PT','DE', 'ES', 'PT','DE', 'ES', 'PT','DE', 'ES', 'PT','DE', 'ES', 'PT','DE', 'ES', 'PT','DE', 'ES', 'PT','DE', 'ES', 'PT','DE', 'ES', 'PT'];

$response = $this->post(route('api.v1.statements.store'), [
"statements" => $statements
], [
'Accept' => 'application/json'
]);
$response->assertStatus(Response::HTTP_CREATED);

$this->assertCount(15, Statement::all());
$last = Statement::orderBy('id', 'desc')->first();
$territorial_scope = $last->territorial_scope;
$this->assertEquals(["DE", "ES", "PT"], $territorial_scope);
}

/**
* @test
*/
Expand Down

0 comments on commit 26b96fe

Please sign in to comment.