76 lines
2.6 KiB
PHP
76 lines
2.6 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature;
|
|
|
|
use Tests\TestCase;
|
|
|
|
class SitePagesTest extends TestCase
|
|
{
|
|
protected function setUp(): void
|
|
{
|
|
parent::setUp();
|
|
|
|
config()->set('dewemoji.data_path', base_path('tests/Fixtures/emojis.fixture.json'));
|
|
config()->set('dewemoji.apk_release.enabled', true);
|
|
config()->set('dewemoji.apk_release.r2_public_base_url', 'https://downloads.example.com');
|
|
config()->set('dewemoji.apk_release.r2_keys.latest_apk', 'apk/dewemoji-latest.apk');
|
|
config()->set('dewemoji.apk_release.r2_keys.version_json', 'apk/version.json');
|
|
config()->set('dewemoji.apk_release.assetlinks.fingerprints', [
|
|
'AA:BB:CC:DD:EE:FF:00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD:EE:FF:00:11:22:33:44:55:66:77:88:99',
|
|
]);
|
|
}
|
|
|
|
public function test_core_pages_are_available(): void
|
|
{
|
|
$this->get('/')->assertOk();
|
|
$this->get('/browse')->assertOk();
|
|
$this->get('/animals')->assertOk();
|
|
$this->get('/animals/animal-mammal')->assertOk();
|
|
$this->get('/api-docs')->assertOk();
|
|
$this->get('/pricing')->assertOk();
|
|
$this->get('/support')->assertOk();
|
|
$this->get('/privacy')->assertOk();
|
|
$this->get('/terms')->assertOk();
|
|
$this->get('/robots.txt')->assertOk();
|
|
$this->get('/sitemap.xml')->assertOk();
|
|
}
|
|
|
|
public function test_emoji_detail_page_works_with_valid_slug(): void
|
|
{
|
|
$this->get('/emoji/grinning-face')
|
|
->assertOk()
|
|
->assertSee('grinning face');
|
|
}
|
|
|
|
public function test_emoji_detail_page_returns_404_for_unknown_slug(): void
|
|
{
|
|
$this->get('/emoji/unknown-slug')->assertNotFound();
|
|
}
|
|
|
|
public function test_download_redirect_endpoints_are_available(): void
|
|
{
|
|
$this->get('/downloads/version.json')
|
|
->assertStatus(302)
|
|
->assertRedirect('https://downloads.example.com/apk/version.json');
|
|
|
|
$this->get('/downloads/dewemoji-latest.apk')
|
|
->assertStatus(302)
|
|
->assertRedirect('https://downloads.example.com/apk/dewemoji-latest.apk');
|
|
}
|
|
|
|
public function test_assetlinks_endpoint_is_available(): void
|
|
{
|
|
$this->get('/.well-known/assetlinks.json')
|
|
->assertOk()
|
|
->assertJson([
|
|
[
|
|
'relation' => ['delegate_permission/common.handle_all_urls'],
|
|
'target' => [
|
|
'namespace' => 'android_app',
|
|
'package_name' => 'com.dewemoji.app',
|
|
],
|
|
],
|
|
]);
|
|
}
|
|
}
|