提交 62dd248b 编写于 作者: T Tomas Vik

Merge branch '414-fix-pipeline-actions' into 'main'

fix: pipeline actions not working

See merge request gitlab-org/gitlab-vscode-extension!290
......@@ -444,7 +444,7 @@ export async function handlePipelineAction(action: string, repositoryRoot: strin
}
try {
const { response } = await fetch(endpoint, 'POST');
const { response } = await fetch(repositoryRoot, endpoint, 'POST');
return response;
} catch (e) {
throw new UserFriendlyError(`Failed to ${action} pipeline.`, e);
......
const assert = require('assert');
const sinon = require('sinon');
const { tokenService } = require('../../src/services/token_service');
const pipelinesResponse = require('./fixtures/rest/pipelines.json');
const {
getServer,
createTextEndpoint,
createQueryJsonEndpoint,
createPostEndpoint,
} = require('./test_infrastructure/mock_server');
const { GITLAB_URL } = require('./test_infrastructure/constants');
const { simulateQuickPickChoice } = require('./test_infrastructure/helpers');
const { showPicker } = require('../../src/pipeline_actions_picker');
const { instance: statusbar } = require('../../src/status_bar');
describe('Pipeline actions', async () => {
let server;
let statusBarRefreshSpy;
const sandbox = sinon.createSandbox();
before(async () => {
server = getServer([
createQueryJsonEndpoint('/projects/278964/pipelines', { '?ref=master': pipelinesResponse }),
createTextEndpoint(
'/projects/278964/snippets/222/files/master/test2.js/raw',
'second blob content',
),
createPostEndpoint('/projects/278964/pipeline', pipelinesResponse[0]), // simulating returning a newly created pipeline
]);
await tokenService.setToken(GITLAB_URL, 'abcd-secret');
});
beforeEach(async () => {
server.resetHandlers();
statusBarRefreshSpy = sandbox.spy(statusbar, 'refresh');
});
afterEach(async () => {
sandbox.restore();
});
after(async () => {
server.close();
await tokenService.setToken(GITLAB_URL, undefined);
});
it('creates a new pipeline', async () => {
simulateQuickPickChoice(sandbox, 1); // Create a new pipeline from current branch
await showPicker();
assert(
statusBarRefreshSpy.calledOnce,
'status bar is refreshed after successful pipeline creation',
);
});
});
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册