Skip to content

Commit

Permalink
Test meta file isn't created
Browse files Browse the repository at this point in the history
  • Loading branch information
duncanmcclean committed Jan 10, 2024
1 parent 1152ed5 commit 28a84ef
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/Assets/AssetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,23 @@ public function it_properly_merges_new_unsaved_data_to_meta()
$this->assertEquals($expectedAfterMerge, $asset->meta());
}

/** @test */
public function it_does_not_write_to_meta_file_when_asset_does_not_exist()
{
Storage::fake('test');

$container = Facades\AssetContainer::make('test')->disk('test');
$asset = (new Asset)->container($container)->path('foo/test.txt');

// No meta file should exist yet...
$this->assertFalse(Storage::disk('test')->exists('foo/.meta/test.txt.yaml'));

// Calling `meta` should return an empty meta array, but not write a meta file...
$meta = $asset->meta();
$this->assertEquals(['data' => []], $meta);
$this->assertFalse(Storage::disk('test')->exists('foo/.meta/test.txt.yaml'));
}

/** @test */
public function it_gets_meta_path()
{
Expand Down

0 comments on commit 28a84ef

Please sign in to comment.