Updating Tag.create function to match latest API

This commit is contained in:
Justin Dalrymple 2021-12-01 14:58:37 -05:00
parent a365c64014
commit 561f2abf99
2 changed files with 13 additions and 7 deletions

View File

@ -27,12 +27,14 @@ export class Tags<C extends boolean = false> extends BaseResource<C> {
);
}
create(projectId: string | number, options?: BaseRequestOptions) {
return RequestHelper.post<TagSchema>()(
this,
endpoint`projects/${projectId}/repository/tags`,
options,
);
create(projectId: string | number, tagName: string, ref: string, options?: BaseRequestOptions) {
return RequestHelper.post<TagSchema>()(this, endpoint`projects/${projectId}/repository/tags`, {
query: {
tagName,
ref,
},
...options,
});
}
remove(projectId: string | number, tagName: string, options?: Sudo) {

View File

@ -40,10 +40,14 @@ describe('Tags.all', () => {
describe('Tags.create', () => {
it('should request POST /projects/:id/repository/tags', async () => {
await service.create(1, { test: 1 });
await service.create(1, 'test', 'main', { test: 1 });
expect(RequestHelper.post()).toHaveBeenCalledWith(service, 'projects/1/repository/tags', {
test: 1,
query: {
ref: 'main',
tagName: 'test',
},
});
});
});