[MIGRATION] - Migrating to Jest - working but some tests fails

This commit is contained in:
VitoAlbano
2024-11-15 09:24:34 +00:00
committed by Vito Albano
parent 7c6e9ab831
commit 3039d1612f
2 changed files with 11 additions and 12 deletions

View File

@@ -19,6 +19,7 @@ import assert from 'assert';
import { AlfrescoApi, ContentApi, Oauth2Auth } from '../src';
import { EcmAuthMock, OAuthMock } from './mockObjects';
import jsdom from 'jsdom';
import { jest } from '@jest/globals';
const { JSDOM } = jsdom;
const globalAny: any = global;
@@ -168,8 +169,8 @@ describe('Oauth2 test', () => {
});
});
it('should refresh token when the login not use the implicitFlow ', function (done) {
this.timeout(3000);
it('should refresh token when the login not use the implicitFlow ', (done) => {
jest.setTimeout(3000);
oauth2Mock.get200Response();
const oauth2Auth = new Oauth2Auth(
@@ -204,8 +205,8 @@ describe('Oauth2 test', () => {
oauth2Auth.login('admin', 'admin');
});
it('should not hang the app also if teh logout is missing', function (done) {
this.timeout(3000);
it('should not hang the app also if teh logout is missing', (done) => {
jest.setTimeout(3000);
oauth2Mock.get200Response();
const oauth2Auth = new Oauth2Auth(
@@ -426,7 +427,7 @@ describe('Oauth2 test', () => {
// TODO: very flaky test, fails on different machines if running slow, might relate to `this.timeout`
// eslint-disable-next-line ban/ban
xit('should extend content session after oauth token refresh', function (done) {
this.timeout(3000);
jest.setTimeout(3000);
oauth2Mock.get200Response();
authResponseMock.get200ValidTicket();
@@ -464,7 +465,7 @@ describe('Oauth2 test', () => {
});
alfrescoApi.login('admin', 'admin');
this.timeout(3000);
jest.setTimeout(3000);
alfrescoApi.refreshToken();
});

View File

@@ -61,12 +61,10 @@ describe('Upload', () => {
const file = createTestFileStream('testFile.txt');
uploadApi.uploadFile(file).catch(
(error: any) => {
assert.equal(error.status, 409);
done();
}
);
uploadApi.uploadFile(file).catch((error: any) => {
assert.equal(error.status, 409);
done();
});
});
it('upload file should get 200 and rename if the new name clashes with an existing file in the current parent folder and autorename is true', async () => {