Skip to content

Commit

Permalink
test: first test
Browse files Browse the repository at this point in the history
  • Loading branch information
DavideIadeluca committed Dec 17, 2024
1 parent bd94294 commit 514d6d1
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions tests/integration/notifications/NotificationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,70 @@ public function setUp(): void
],
]);
}

/**
* @test
*/
public function notification_sent_when_new_discussion_in_followed_tag()
{
$response = $this->send(
$this->request('POST', '/api/discussions', [
'authenticatedAs' => 1,
'json' => [
'data' => [
'attributes' => [
'title' => 'New discussion',
'content' => '<t><p>New Post</p></t>',
],
'relationships' => [
'tags' => [
'data' => [
['type' => 'tags', 'id' => 1]
]
]
]
],
],
])
);

$this->assertEquals(201, $response->getStatusCode());

$response = $this->send(
$this->request('GET', '/api/notifications', [
'authenticatedAs' => 2,
])
);

$this->assertEquals(200, $response->getStatusCode());

$response = json_decode($response->getBody(), true);

$this->assertEquals(1, count($response['data']));
$this->assertEquals('newDiscussionInTag', $response['data'][0]['attributes']['contentType']);
}

/**
* @test
*/
public function no_notification_sent_when_new_post_in_followed_tag()
{

}

/**
* @test
*/
public function notification_sent_when_new_discussion_in_lurked_tag()
{

}

/**
* @test
*/
public function notification_sent_when_new_post_in_lurked_tag()
{

}
}

0 comments on commit 514d6d1

Please sign in to comment.