mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[AAE-4863] Fixed the async and done warning due to new version of Karma (#6938)
* [AAE-4863] Fixed the async and done warning due to new version of Karma * Fixed lint error
This commit is contained in:
@@ -30,21 +30,20 @@ const preventAngularFromResetting = () => (TestBed.resetTestingModule = () => Te
|
|||||||
const allowAngularToReset = () => (TestBed.resetTestingModule = resetTestingModule);
|
const allowAngularToReset = () => (TestBed.resetTestingModule = resetTestingModule);
|
||||||
|
|
||||||
export const setupTestBed = (moduleDef: TestModuleMetadata) => {
|
export const setupTestBed = (moduleDef: TestModuleMetadata) => {
|
||||||
beforeAll((done) =>
|
beforeAll((done) => {
|
||||||
(async () => {
|
|
||||||
localStorage.clear();
|
localStorage.clear();
|
||||||
sessionStorage.clear();
|
sessionStorage.clear();
|
||||||
resetTestingModule();
|
resetTestingModule();
|
||||||
preventAngularFromResetting();
|
preventAngularFromResetting();
|
||||||
TestBed.configureTestingModule(moduleDef);
|
TestBed.configureTestingModule(moduleDef);
|
||||||
await TestBed.compileComponents();
|
TestBed.compileComponents()
|
||||||
|
.then(() => {
|
||||||
// prevent Angular from resetting testing module
|
TestBed.resetTestingModule = () => TestBed;
|
||||||
TestBed.resetTestingModule = () => TestBed;
|
done();
|
||||||
})()
|
})
|
||||||
.then(done)
|
.catch(done.fail);
|
||||||
.catch(done.fail)
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
afterAll(() => allowAngularToReset());
|
afterAll(() => allowAngularToReset());
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user