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) => {
|
||||
const data = await alfrescoJsApi.login('admin', 'admin');
|
||||
assert.equal(data, 'TICKET_4479f4d3bb155195879bfbb8d5206f433488a1b1');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
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) => {
|
||||
const error = await alfrescoJsApi.login('wrong', 'name');
|
||||
assert.equal(error.status, 403);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
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(() => {
|
||||
await alfrescoJsApi.login('admin', 'admin');
|
||||
assert.equal(alfrescoJsApi.isLoggedIn(), true);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
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(() => {
|
||||
await alfrescoJsApi.logout();
|
||||
assert.equal(alfrescoJsApi.isLoggedIn(), false);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
@@ -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) => {
|
||||
const data = await processAuth.login('admin', 'admin');
|
||||
assert.equal(data, 'Basic YWRtaW46YWRtaW4=');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
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": ["**/*"]
|
||||
|
43
package-lock.json
generated
43
package-lock.json
generated
@@ -87,6 +87,7 @@
|
||||
"@types/event-emitter": "^0.3.3",
|
||||
"@types/jasmine": "4.0.3",
|
||||
"@types/jasminewd2": "~2.0.2",
|
||||
"@types/jest": "^29.5.14",
|
||||
"@types/jsdom": "^21.1.5",
|
||||
"@types/minimatch": "^3.0.3",
|
||||
"@types/mocha": "^10.0.6",
|
||||
@@ -17394,6 +17395,48 @@
|
||||
"@types/jasmine": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/jest": {
|
||||
"version": "29.5.14",
|
||||
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.14.tgz",
|
||||
"integrity": "sha512-ZN+4sdnLUbo8EVvVc2ao0GFW6oVrQRPn4K2lglySj7APvSrgzxHiNNK99us4WDMi57xxA2yggblIAMNhXOotLQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"expect": "^29.0.0",
|
||||
"pretty-format": "^29.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/jest/node_modules/ansi-styles": {
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz",
|
||||
"integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/jest/node_modules/pretty-format": {
|
||||
"version": "29.7.0",
|
||||
"resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz",
|
||||
"integrity": "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@jest/schemas": "^29.6.3",
|
||||
"ansi-styles": "^5.0.0",
|
||||
"react-is": "^18.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/jest/node_modules/react-is": {
|
||||
"version": "18.3.1",
|
||||
"resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz",
|
||||
"integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/jsdom": {
|
||||
"version": "21.1.7",
|
||||
"dev": true,
|
||||
|
@@ -107,6 +107,7 @@
|
||||
"@types/event-emitter": "^0.3.3",
|
||||
"@types/jasmine": "4.0.3",
|
||||
"@types/jasminewd2": "~2.0.2",
|
||||
"@types/jest": "^29.5.14",
|
||||
"@types/jsdom": "^21.1.5",
|
||||
"@types/minimatch": "^3.0.3",
|
||||
"@types/mocha": "^10.0.6",
|
||||
|
Reference in New Issue
Block a user