Skip to content

Commit 16d4bda

Browse files
SIGN-7471 - added tests
1 parent 292f907 commit 16d4bda

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

actions/submit-signing-request/tests/task.test.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const testOrganizationId = 'TEST_ORGANIZATION_ID';
2424
const testProjectSlug = 'TEST_PROJECT_SLUG';
2525
const testSigningPolicySlug = 'TEST_POLICY_SLUG';
2626
const testGitHubToken = 'TEST_GITHUB_TOKEN';
27+
const testConnectorLogMessage = 'TEST_CONNECTOR_LOG_MESSAGE';
2728

2829
const defaultTestInputMap = {
2930
'wait-for-completion': 'true',
@@ -61,7 +62,7 @@ beforeEach(() => {
6162
status: 'Completed',
6263
unsignedArtifactLink: testUnsignedArtifactLink,
6364
signedArtifactLink: testSignedArtifactLink,
64-
logs: [ { message: 'TEST_MESSAGE', level: 'Information' } ]
65+
logs: [ { message: testConnectorLogMessage, level: 'Information' } ]
6566
};
6667

6768
const getSigningRequestResponse = submitSigningRequestResponse;
@@ -145,15 +146,15 @@ it('test that the signing request was not submitted due to validation errors', a
145146
return value.includes('TEST_ERROR');
146147
}));
147148
// check that howToFix message was logged
148-
const infoLogStub = sandbox.stub(core, 'info')
149+
const coreInfoStub = sandbox.stub(core, 'info')
149150
.withArgs(sinon.match((value:any) => {
150151
return value.includes('TEST_FIX');
151152
}));
152153

153154
await task.run();
154155
assert.equal(setFailedStub.calledOnce, true);
155156
assert.equal(errorLogStub.called, true);
156-
assert.equal(infoLogStub.called, true);
157+
assert.equal(coreInfoStub.called, true);
157158
});
158159

159160
it('test that the output variables are set correctly', async () => {
@@ -164,6 +165,15 @@ it('test that the output variables are set correctly', async () => {
164165
assert.equal(setOutputStub.calledWith('signed-artifact-download-url', testSignedArtifactLink), true);
165166
});
166167

168+
it('connector logs logged to the build log', async () => {
169+
const coreInfoStub = sandbox.stub(core, 'info')
170+
.withArgs(sinon.match((value:any) => {
171+
return value.includes(testConnectorLogMessage);
172+
}));
173+
await task.run();
174+
assert.equal(coreInfoStub.called, true);
175+
});
176+
167177
it('test that the connectors url has api version', async () => {
168178
await task.run();
169179
assert.equal(axiosPostStub.calledWith(

0 commit comments

Comments
 (0)