AAE-30882 - Fixed unit test for js-api

This commit is contained in:
VitoAlbano
2025-08-22 13:32:56 +01:00
committed by Vito Albano
parent f3090dc9d1
commit 1aa7f27b8b
2 changed files with 24 additions and 8 deletions

View File

@@ -48,20 +48,20 @@ describe('Ecm Auth test', () => {
assert.equal(auth.authentications.basicAuth.username, 'johndoe');
});
it('should forget username on logout', (done) => {
it('should forget username on logout', async () => {
const auth = new ContentAuth({}, alfrescoJsApi);
authEcmMock.get201Response();
authEcmMock.get201ResponseJohnDoe();
auth.login('johndoe', 'password');
assert.equal(auth.authentications.basicAuth.username, 'johndoe');
await auth.login('johndoe', 'password');
assert.equal(auth.authentications.basicAuth.username, 'ROLE_TICKET');
assert.equal(auth.storage.getItem('ACS_USERNAME'), 'johndoe');
authEcmMock.get204ResponseLogout();
auth.logout().then(() => {
assert.equal(auth.authentications.basicAuth.username, null);
done();
});
await auth.logout();
assert.equal(auth.authentications.basicAuth.username, null);
assert.equal(auth.storage.getItem('ACS_USERNAME'), '');
});
describe('With Authentication', () => {