Skip to content

Commit ba8de45

Browse files
committed
fix: use doGet() in PublishCollection implemementation
1 parent 1a5db45 commit ba8de45

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/collections/infra/repositories/CollectionsRepository.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ export class CollectionsRepository extends ApiRepository implements ICollections
8888
throw error
8989
})
9090
}
91-
public async publishCollection(collectionId: string | number): Promise<void> {
91+
public async publishCollection(collectionIdOrAlias: string | number): Promise<void> {
9292
return this.doPost(
93-
this.buildApiEndpoint(this.collectionsResourceName, `actions/:publish`, collectionId),
93+
`/${this.collectionsResourceName}/${collectionIdOrAlias}/actions/:publish`,
9494
{}
9595
)
9696
.then(() => undefined)

test/functional/datasets/PublishCollection.test.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,22 @@ describe('execute', () => {
1717
)
1818
})
1919

20-
test('should successfully publish a collection', async () => {
20+
test('should successfully publish a collection with id', async () => {
2121
const createdCollectiontIdentifier = await createCollection.execute(testNewCollection)
2222

2323
const response = await publishCollection.execute(createdCollectiontIdentifier)
2424

2525
expect(response).toBeUndefined()
2626
await deleteCollectionViaApi(testNewCollection.alias)
2727
})
28+
test('should successfully publish a collection with alias', async () => {
29+
await createCollection.execute(testNewCollection)
30+
31+
const response = await publishCollection.execute(testNewCollection.alias)
32+
33+
expect(response).toBeUndefined()
34+
await deleteCollectionViaApi(testNewCollection.alias)
35+
})
2836

2937
test('should throw an error when trying to publish a collection that does not exist', async () => {
3038
const nonExistentTestCollectionId = 4567

0 commit comments

Comments
 (0)