refs #6264 test: remove force describe for dms test

This commit is contained in:
Javier Segarra 2023-12-14 12:35:54 +01:00
parent d0af29c0c5
commit 1939c65fab
7 changed files with 3 additions and 32 deletions

View File

@ -1,6 +1,5 @@
const app = require('vn-loopback/server/server'); const app = require('vn-loopback/server/server');
// f
describe('TicketDms removeFile()', () => { describe('TicketDms removeFile()', () => {
const ticketDmsId = 1; const ticketDmsId = 1;
it(`should return an error for a user without enough privileges`, async() => { it(`should return an error for a user without enough privileges`, async() => {

View File

@ -1,6 +1,5 @@
const models = require('vn-loopback/server/server').models; const models = require('vn-loopback/server/server').models;
// f
describe('ClientDms removeFile()', () => { describe('ClientDms removeFile()', () => {
it(`should return an error for a user without enough privileges`, async() => { it(`should return an error for a user without enough privileges`, async() => {
const tx = await models.Client.beginTransaction({}); const tx = await models.Client.beginTransaction({});

View File

@ -1,5 +1,5 @@
const models = require('vn-loopback/server/server').models; const models = require('vn-loopback/server/server').models;
// f
describe('Ticket uploadFile()', () => { describe('Ticket uploadFile()', () => {
it(`should return an error for a user without enough privileges`, async() => { it(`should return an error for a user without enough privileges`, async() => {
const tx = await models.Ticket.beginTransaction({}); const tx = await models.Ticket.beginTransaction({});
@ -23,27 +23,4 @@ describe('Ticket uploadFile()', () => {
expect(error.message).toEqual(`You don't have enough privileges`); expect(error.message).toEqual(`You don't have enough privileges`);
}); });
// fit(`should uploadFile`, async() => {
// const tx = await models.Ticket.beginTransaction({});
// let error;
// try {
// const options = {transaction: tx};
// const ticketId = 15;
// const currentUserId = 9;
// const ticketTypeId = 14;
// const ctx = {req: {accessToken: {userId: currentUserId}}, args: {dmsTypeId: ticketTypeId}, result: new ArrayBuffer(20000)};
// await models.Ticket.uploadFile(ctx, ticketId, options);
// await tx.rollback();
// } catch (e) {
// await tx.rollback();
// error = e;
// }
// expect(error.message).toEqual(`You don't have enough privileges`);
// });
}); });

View File

@ -61,6 +61,7 @@ module.exports = Self => {
try { try {
const uploadedFiles = await Dms.uploadFile(ctx, myOptions); const uploadedFiles = await Dms.uploadFile(ctx, myOptions);
const promises = uploadedFiles.map(dms => TicketDms.create({ const promises = uploadedFiles.map(dms => TicketDms.create({
ticketFk: id, ticketFk: id,
dmsFk: dms.id dmsFk: dms.id

View File

@ -30,14 +30,10 @@ module.exports = Self => {
} }
try { try {
// const dms = await Self.app.models.Dms.findById(id, null, myOptions);
const WorkerDms = await Self.findOne({ const WorkerDms = await Self.findOne({
where: {document: id} where: {document: id}
}, myOptions); }, myOptions);
// const targetDms = await Self.app.models.Dms.removeFile(ctx, id, myOptions);
// const WorkerDms = await Self.findById(+targetDms.reference, null, myOptions);
const targetDms = await Self.app.models.Dms.removeFile(ctx, id, myOptions); const targetDms = await Self.app.models.Dms.removeFile(ctx, id, myOptions);
if (!targetDms || !WorkerDms) if (!targetDms || !WorkerDms)

View File

@ -1,6 +1,5 @@
const app = require('vn-loopback/server/server'); const app = require('vn-loopback/server/server');
// f
describe('WorkerDms removeFile()', () => { describe('WorkerDms removeFile()', () => {
const workerDmsFk = 1; const workerDmsFk = 1;
it(`should return an error for a user without enough privileges`, async() => { it(`should return an error for a user without enough privileges`, async() => {

View File

@ -1,5 +1,5 @@
const app = require('vn-loopback/server/server'); const app = require('vn-loopback/server/server');
// f
describe('Worker uploadFile()', () => { describe('Worker uploadFile()', () => {
it(`should return an error for a user without enough privileges`, async() => { it(`should return an error for a user without enough privileges`, async() => {
let workerId = 1106; let workerId = 1106;