Skip to content

Commit 003c1d5

Browse files
committed
Updated Tests + readme.md
1 parent f8a7af4 commit 003c1d5

File tree

5 files changed

+34
-14
lines changed

5 files changed

+34
-14
lines changed

README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ files, streams, and posts.
2525
* [List Artifacts](#list-artifacts)
2626
* [Upload A File](#upload-a-file)
2727
* [Create A Child To An Artifact](#create-a-child-to-an-artifact)
28+
* [Delete An Artifact](#delete-an-artifact)
2829
* [Create A Post In A Given Stream](#create-a-post-in-a-given-stream)
2930
* [DTO Showcase](#dto-showcase)
3031
* [Available Enums](#available-enums)
@@ -141,6 +142,7 @@ $fileName = 'foobar.pdf';
141142
$response = $connector->send(new UploadAFileRequest(
142143
fileContent: $fileContent,
143144
fileName: $fileName,
145+
usageType: 'attachment_file',
144146
));
145147
```
146148

@@ -168,6 +170,18 @@ $response = $connector->send(new CreateAChildToAnArtifact(
168170
));
169171
```
170172

173+
### Delete An Artifact
174+
175+
```php
176+
use CodebarAg\LaravelBeekeeper\Requests\DeleteAnArtifact;
177+
178+
$response = $connector->send(new DeleteAnArtifact(
179+
artifactId: '12345678-abcd-efgh-9012-de00edbf7b0b'
180+
));
181+
182+
// Returns a 204 No Content response on success
183+
```
184+
171185
### Create A Post In A Given Stream
172186

173187
```php
@@ -206,8 +220,6 @@ $response = $connector->send(new CreateAPostInAGivenStream(
206220
reactionsDisabled: true,
207221
scheduledAt: '2019-08-24T14:15:22',
208222
files: [$fileData],
209-
photos: [$fileData],
210-
videos: [$fileData],
211223
media: [$fileData],
212224
options: [
213225
['text' => 'This Friday'],

tests/Feature/Requests/CreateAPostInAGivenStreamRequestTest.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,6 @@
7878
->and($post->uuid)->toBeString()
7979
->and($post->labels)->toBeInstanceOf(Collection::class)
8080
->and($post->files)->toBeInstanceOf(Collection::class)
81-
->and($post->photos)->toBeInstanceOf(Collection::class)
82-
->and($post->videos)->toBeInstanceOf(Collection::class)
8381
->and($post->media)->toBeInstanceOf(Collection::class)
8482
->and($post->options)->toBeInstanceOf(Collection::class)
8583
->and($post->mentions)->toBeInstanceOf(Collection::class);
@@ -168,8 +166,6 @@
168166
reactionsDisabled: true,
169167
scheduledAt: '2019-08-24T14:15:22',
170168
files: [$fileData],
171-
photos: [$fileData],
172-
videos: [$fileData],
173169
media: [$fileData],
174170
options: [
175171
['text' => 'This Friday'],
@@ -192,10 +188,6 @@
192188
->and($post->scheduledAt)->toBeInstanceOf(CarbonImmutable::class)
193189
->and($post->files)->toHaveCount(1)
194190
->and($post->files->first())->toBeInstanceOf(File::class)
195-
->and($post->photos)->toHaveCount(1)
196-
->and($post->photos->first())->toBeInstanceOf(File::class)
197-
->and($post->videos)->toHaveCount(1)
198-
->and($post->videos->first())->toBeInstanceOf(File::class)
199191
->and($post->media)->toHaveCount(1)
200192
->and($post->media->first())->toBeInstanceOf(File::class)
201193
->and($post->options)->toHaveCount(2)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
use CodebarAg\LaravelBeekeeper\Connectors\BeekeeperConnector;
4+
use CodebarAg\LaravelBeekeeper\Requests\DeleteAnArtifact;
5+
use Saloon\Http\Faking\MockResponse;
6+
use Saloon\Laravel\Facades\Saloon;
7+
8+
test('can delete an artifact', function () {
9+
Saloon::fake([
10+
DeleteAnArtifact::class => MockResponse::make([], 204),
11+
]);
12+
13+
$connector = new BeekeeperConnector;
14+
$response = $connector->send(new DeleteAnArtifact(
15+
artifactId: '12345678-abcd-efgh-9012-de00edbf7b0b'
16+
));
17+
18+
expect($response->status())->toBe(204);
19+
})->group('artifacts');

tests/Feature/Requests/UploadAFileRequestTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
$response = $connector->send(new UploadAFileRequest(
3939
fileContent: $fileContent,
4040
fileName: $fileName,
41+
usageType: 'attachment_file',
4142
));
4243

4344
$uploadAFile = $response->dto();

tests/Unit/Requests/CreateAPostInAGivenStreamRequestTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@
4343
reactionsDisabled: true,
4444
scheduledAt: '2019-08-24T14:15:22',
4545
files: [$fileData],
46-
photos: [$fileData],
47-
videos: [$fileData],
4846
media: [$fileData],
4947
options: [
5048
['text' => 'Option 1'],
@@ -291,8 +289,6 @@
291289
->and($post->files)->toBeInstanceOf(Collection::class)
292290
->and($post->files)->toHaveCount(1)
293291
->and($post->files->first())->toBeInstanceOf(File::class)
294-
->and($post->photos)->toBeInstanceOf(Collection::class)
295-
->and($post->videos)->toBeInstanceOf(Collection::class)
296292
->and($post->media)->toBeInstanceOf(Collection::class)
297293
->and($post->options)->toBeInstanceOf(Collection::class)
298294
->and($post->options)->toHaveCount(2)

0 commit comments

Comments
 (0)