This commit is contained in:
parent
2dba0b87ed
commit
68520e046a
|
@ -7,7 +7,7 @@ let obj = {};
|
||||||
const STORAGE_IMAGE_USER = 'storage/image/user';
|
const STORAGE_IMAGE_USER = 'storage/image/user';
|
||||||
const _23_F2 = '23/f2';
|
const _23_F2 = '23/f2';
|
||||||
const FULL_23_F2 = `full/${_23_F2}`;
|
const FULL_23_F2 = `full/${_23_F2}`;
|
||||||
describe('loopback model Image', () => {
|
fdescribe('loopback model Image', () => {
|
||||||
const userId = 1107;
|
const userId = 1107;
|
||||||
|
|
||||||
const activeCtx = {
|
const activeCtx = {
|
||||||
|
@ -26,6 +26,23 @@ describe('loopback model Image', () => {
|
||||||
fileName,
|
fileName,
|
||||||
entityId,
|
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(() => {
|
beforeEach(() => {
|
||||||
|
@ -79,14 +96,24 @@ describe('loopback model Image', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(async() => {
|
afterAll(async() => {
|
||||||
try {
|
// cleanResources();
|
||||||
await fs.unlink(`${STORAGE_IMAGE_USER}/full/${nameItem}`);
|
|
||||||
|
|
||||||
await fs.unlink(`${STORAGE_IMAGE_USER}/520x520/${nameItem}`);
|
|
||||||
|
|
||||||
await fs.unlink(`${STORAGE_IMAGE_USER}/1600x1600/${nameItem}`);
|
|
||||||
} catch (e) {
|
|
||||||
throw new Error(e);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function cleanResources() {
|
||||||
|
try {
|
||||||
|
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) {
|
||||||
|
console.warn(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue