mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[MIGRATION] - Fixing failing migrated tests
This commit is contained in:
@@ -52,46 +52,38 @@ describe('Auth', () => {
|
||||
});
|
||||
|
||||
describe('login', () => {
|
||||
it('should return the Ticket if all is ok', (done) => {
|
||||
it('should return the Ticket if all is ok', async () => {
|
||||
authResponseEcmMock.get201Response();
|
||||
|
||||
alfrescoJsApi.login('admin', 'admin').then((data: string) => {
|
||||
assert.equal(data, 'TICKET_4479f4d3bb155195879bfbb8d5206f433488a1b1');
|
||||
done();
|
||||
});
|
||||
const data = await alfrescoJsApi.login('admin', 'admin');
|
||||
assert.equal(data, 'TICKET_4479f4d3bb155195879bfbb8d5206f433488a1b1');
|
||||
});
|
||||
|
||||
it('should return an error if wrong credential are used 403 the login fails', (done) => {
|
||||
it('should return an error if wrong credential are used 403 the login fails', async () => {
|
||||
authResponseEcmMock.get403Response();
|
||||
|
||||
alfrescoJsApi.login('wrong', 'name').then(NOOP, (error: ErrorResponse) => {
|
||||
assert.equal(error.status, 403);
|
||||
done();
|
||||
});
|
||||
const error = await alfrescoJsApi.login('wrong', 'name');
|
||||
assert.equal(error.status, 403);
|
||||
});
|
||||
});
|
||||
|
||||
describe('isLoggedIn', () => {
|
||||
it('should return true if the api is logged in', (done) => {
|
||||
it('should return true if the api is logged in', async () => {
|
||||
authResponseEcmMock.get201Response();
|
||||
|
||||
alfrescoJsApi.login('admin', 'admin').then(() => {
|
||||
assert.equal(alfrescoJsApi.isLoggedIn(), true);
|
||||
done();
|
||||
});
|
||||
await alfrescoJsApi.login('admin', 'admin');
|
||||
assert.equal(alfrescoJsApi.isLoggedIn(), true);
|
||||
});
|
||||
|
||||
it('should return false if the api is logged out', (done) => {
|
||||
it('should return false if the api is logged out', async () => {
|
||||
authResponseEcmMock.get201Response();
|
||||
|
||||
alfrescoJsApi.login('admin', 'admin').catch(NOOP);
|
||||
|
||||
authResponseEcmMock.get204ResponseLogout();
|
||||
|
||||
alfrescoJsApi.logout().then(() => {
|
||||
assert.equal(alfrescoJsApi.isLoggedIn(), false);
|
||||
done();
|
||||
});
|
||||
await alfrescoJsApi.logout();
|
||||
assert.equal(alfrescoJsApi.isLoggedIn(), false);
|
||||
});
|
||||
});
|
||||
|
||||
|
@@ -55,7 +55,7 @@ describe('Bpm Auth test', () => {
|
||||
});
|
||||
|
||||
describe('With Authentication', () => {
|
||||
it('login should return the Ticket if all is ok', (done) => {
|
||||
it('login should return the Ticket if all is ok', async () => {
|
||||
authBpmMock.get200Response();
|
||||
|
||||
const processAuth = new ProcessAuth({
|
||||
@@ -63,10 +63,8 @@ describe('Bpm Auth test', () => {
|
||||
contextRootBpm: 'activiti-app'
|
||||
});
|
||||
|
||||
processAuth.login('admin', 'admin').then((data) => {
|
||||
assert.equal(data, 'Basic YWRtaW46YWRtaW4=');
|
||||
done();
|
||||
});
|
||||
const data = await processAuth.login('admin', 'admin');
|
||||
assert.equal(data, 'Basic YWRtaW46YWRtaW4=');
|
||||
});
|
||||
|
||||
it('login password should be removed after login', (done) => {
|
||||
|
@@ -103,7 +103,7 @@ describe('Tags', () => {
|
||||
});
|
||||
|
||||
describe('createTags', () => {
|
||||
it('should return created tags', (done: Mocha.Done) => {
|
||||
it('should return created tags', (done) => {
|
||||
tagMock.createTags201Response();
|
||||
tagsApi.createTags([new TagBody(), new TagBody()]).then((tags) => {
|
||||
assert.equal(tags.length, 2);
|
||||
|
@@ -8,7 +8,7 @@
|
||||
"isolatedModules": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"lib": ["ESNext", "dom"],
|
||||
"types": ["mocha"]
|
||||
"types": ["jest", "node"]
|
||||
},
|
||||
"exclude": [],
|
||||
"include": ["**/*"]
|
||||
|
Reference in New Issue
Block a user