mirror of
https://github.com/linuxserver/Heimdall.git
synced 2026-02-21 12:10:34 +09:00
feat: Add export import
This commit is contained in:
committed by
Attila Kerekes
parent
2ee5d07e48
commit
bb5a078f35
@@ -7,12 +7,14 @@ use Tests\TestCase;
|
||||
|
||||
class ExampleTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
/**
|
||||
* A basic test example.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testBasicTest()
|
||||
public function test_app_loads()
|
||||
{
|
||||
$response = $this->get('/');
|
||||
|
||||
|
||||
81
tests/Feature/ItemExportTest.php
Normal file
81
tests/Feature/ItemExportTest.php
Normal file
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Item;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Date;
|
||||
use Tests\TestCase;
|
||||
|
||||
class ItemExportTest extends TestCase
|
||||
{
|
||||
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_returns_empty_jsonarray_when_there_are_no_items_in_the_db()
|
||||
{
|
||||
$response = $this->get('api/item');
|
||||
|
||||
$response->assertJsonCount(0);
|
||||
}
|
||||
|
||||
public function test_returns_exactly_the_defined_fields()
|
||||
{
|
||||
$exampleItem = [
|
||||
"appdescription" => "Description",
|
||||
"appid" => "123",
|
||||
"colour" => "#000",
|
||||
"description" => "Description",
|
||||
"title" => "Item Title",
|
||||
"url" => "http://gorczany.com/nihil-rerum-distinctio-voluptate-assumenda-accusantium-exercitationem"
|
||||
];
|
||||
|
||||
Item::factory()
|
||||
->create($exampleItem);
|
||||
|
||||
$response = $this->get('api/item');
|
||||
|
||||
$response->assertExactJson([(object)$exampleItem]);
|
||||
}
|
||||
|
||||
public function test_returns_all_items()
|
||||
{
|
||||
Item::factory()
|
||||
->count(3)
|
||||
->create();
|
||||
|
||||
$response = $this->get('api/item');
|
||||
|
||||
$response->assertJsonCount(3);
|
||||
}
|
||||
|
||||
public function test_does_not_return_deleted_item()
|
||||
{
|
||||
Item::factory()
|
||||
->create([
|
||||
'deleted_at' => Date::create('1970')
|
||||
]);
|
||||
|
||||
Item::factory()
|
||||
->create();
|
||||
|
||||
$response = $this->get('api/item');
|
||||
|
||||
$response->assertJsonCount(1);
|
||||
}
|
||||
|
||||
public function test_does_not_return_tags()
|
||||
{
|
||||
Item::factory()
|
||||
->create([
|
||||
'type' => 1
|
||||
]);
|
||||
|
||||
Item::factory()
|
||||
->create();
|
||||
|
||||
$response = $this->get('api/item');
|
||||
|
||||
$response->assertJsonCount(1);
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ class SettingsSeederTest extends TestCase
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testReturnsAJSONMapWithSameAmountOfItemsAsLanguageDirectoriesPresent()
|
||||
public function test_returns_a_jsonmap_with_same_amount_of_items_as_language_directories_present()
|
||||
{
|
||||
$languageDirectories = array_filter(glob(resource_path().'/lang/*'), 'is_dir');
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ class LangTest extends TestCase
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testAllLanguageKeysAreDefined()
|
||||
public function test_all_language_keys_are_defined()
|
||||
{
|
||||
$this->markTestSkipped('2022-11-14 Lot of keys missing. Enable this test to see them all.');
|
||||
$languageDirectories = array_filter(glob(resource_path().'/lang/*'), 'is_dir');
|
||||
|
||||
Reference in New Issue
Block a user