Skip to content

Commit f851983

Browse files
committed
test: add missing user test case for checkUserPushPermission
1 parent 3a5f600 commit f851983

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

test/processors/checkEmptyBranch.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const { Action } = require('../../src/proxy/actions');
66
chai.should();
77
const expect = chai.expect;
88

9-
describe.only('checkEmptyBranch', () => {
9+
describe('checkEmptyBranch', () => {
1010
let exec;
1111
let simpleGitStub;
1212
let gitRawStub;

test/processors/checkUserPushPermission.test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,5 +98,13 @@ describe('checkUserPushPermission', () => {
9898
expect(result.steps[0].error).to.be.true;
9999
expect(logStub.calledWith('Users for this git account: [{"username":"user1","gitAccount":"git-user"},{"username":"user2","gitAccount":"git-user"}]')).to.be.true;
100100
});
101+
102+
it('should return error when no user is set in the action', async () => {
103+
action.user = null;
104+
const result = await exec(req, action);
105+
expect(result.steps).to.have.lengthOf(1);
106+
expect(result.steps[0].error).to.be.true;
107+
expect(result.steps[0].errorMessage).to.include('Push blocked: User not found. Please contact an administrator for support.');
108+
});
101109
});
102110
});

0 commit comments

Comments
 (0)