Skip to content

Commit 36ddc78

Browse files
committed
fix delete atachment test
1 parent 21657ee commit 36ddc78

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/routes/attachments/delete.spec.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ describe('Project Attachments delete', () => {
8888
let sandbox;
8989
beforeEach(() => {
9090
sandbox = sinon.sandbox.create();
91+
sandbox.stub(fileService, 'deleteFile').returns(Promise.resolve());
9192
});
9293
afterEach(() => {
9394
sandbox.restore();
@@ -115,9 +116,6 @@ describe('Project Attachments delete', () => {
115116

116117

117118
it('should return 204 if the CREATOR removes the file attachment successfully', (done) => {
118-
sinon.stub(fileService, 'deleteFile');
119-
const deleteSpy = sinon.spy(fileService, 'deleteFile');
120-
sandbox.stub(fileService, 'deleteFile', () => '');
121119
request(server)
122120
.delete(`/v5/projects/${project1.id}/attachments/${attachments[0].id}`)
123121
.set({
@@ -140,8 +138,6 @@ describe('Project Attachments delete', () => {
140138
if (!res) {
141139
throw new Error('Should found the entity');
142140
} else {
143-
deleteSpy.calledOnce.should.be.true;
144-
145141
chai.assert.isNotNull(res.deletedAt);
146142
chai.assert.isNotNull(res.deletedBy);
147143

0 commit comments

Comments
 (0)