refs #5576 test: fix
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Javier Segarra 2024-04-01 12:11:57 +02:00
parent 2dba0b87ed
commit 68520e046a
1 changed files with 37 additions and 10 deletions

View File

@ -7,7 +7,7 @@ let obj = {};
const STORAGE_IMAGE_USER = 'storage/image/user';
const _23_F2 = '23/f2';
const FULL_23_F2 = `full/${_23_F2}`;
describe('loopback model Image', () => {
fdescribe('loopback model Image', () => {
const userId = 1107;
const activeCtx = {
@ -26,6 +26,23 @@ describe('loopback model Image', () => {
fileName,
entityId,
};
cleanResources();
// try {
// await fs.unlink(`${STORAGE_IMAGE_USER}/full/${FULL_23_F2}/${nameItem}`);
// await fs.unlink(`${STORAGE_IMAGE_USER}/160x100/${FULL_23_F2}/${nameItem}`);
// await fs.unlink(`${STORAGE_IMAGE_USER}/520x520/${FULL_23_F2}/${nameItem}`);
// await fs.unlink(`${STORAGE_IMAGE_USER}/1600x1600/${FULL_23_F2}/${nameItem}`);
// await fs.unlink(`${STORAGE_IMAGE_USER}/full/${nameItem}`);
// await fs.unlink(`${STORAGE_IMAGE_USER}/160x100/${nameItem}`);
// await fs.unlink(`${STORAGE_IMAGE_USER}/520x520/${nameItem}`);
// await fs.unlink(`${STORAGE_IMAGE_USER}/1600x1600/${nameItem}`);
// } catch (e) {
// console.warn(e);
// }
});
beforeEach(() => {
@ -79,14 +96,24 @@ describe('loopback model Image', () => {
});
afterAll(async() => {
// cleanResources();
});
});
async function cleanResources() {
try {
await fs.unlink(`${STORAGE_IMAGE_USER}/full/${nameItem}`);
await fs.unlink(`${STORAGE_IMAGE_USER}/160x160/${nameItem}`);
// await fs.unlink(`${STORAGE_IMAGE_USER}/160x160/${_23_F2}/${nameItem}`);
await fs.unlink(`${STORAGE_IMAGE_USER}/520x520/${nameItem}`);
// await fs.unlink(`${STORAGE_IMAGE_USER}/520x520/${_23_F2}/${nameItem}`);
await fs.unlink(`${STORAGE_IMAGE_USER}/1600x1600/${nameItem}`);
// await fs.unlink(`${STORAGE_IMAGE_USER}/1600x1600/${_23_F2}/${nameItem}`);
await fs.unlink(`${STORAGE_IMAGE_USER}/full/${nameItem}`);
// await fs.unlink(`${STORAGE_IMAGE_USER}/full/${_23_F2}/${nameItem}`);
} catch (e) {
throw new Error(e);
console.warn(e);
}
}
});
});