[MNT-24449] Validate ticket on config initialization (#9882)

* [MNT-24449] Validate ticket on config initialization

* [MNT-24449] Added unit test
This commit is contained in:
Tiago Salvado
2024-07-09 12:56:54 +01:00
committed by GitHub
parent 08baf3e007
commit 3573df01ce
3 changed files with 58 additions and 1 deletions

View File

@@ -40,6 +40,26 @@ describe('Basic configuration test', () => {
'https://testServer.com:1616/strangeContextRoot/api/-default-/public/alfresco/versions/1'
);
});
it('should detect invalid ticket and unset it', (done) => {
const hostEcm = 'https://127.0.0.1:8080';
const authEcmMock = new EcmAuthMock(hostEcm);
const config = {
hostEcm,
authType: 'BASIC',
ticketEcm: 'wrong-ticket'
};
authEcmMock.get401InvalidTicket();
const alfrescoApi = new AlfrescoApi(config);
alfrescoApi.on('ticket_invalidated', () => {
assert.equal(alfrescoApi.config.ticketEcm, null);
done();
});
});
});
describe('setconfig parameter ', () => {