diff --git a/modules/image.js b/modules/image.js index 84d5bc9..5625823 100644 --- a/modules/image.js +++ b/modules/image.js @@ -48,23 +48,6 @@ class Image { } } - async replace(filename, description, imageId) { - try{ - if(filename.length === 0) throw new Error('filename is missing') - let sql - if(description === undefined) sql = `UPDATE images SET image_path = '${filename}' - WHERE image_id = ${imageId};` - else sql = `UPDATE images SET image_path = ${filename}, - image_description = '${description}' WHERE image_id = ${imageId};` - await this.db.run(sql) - sql = 'SELECT last_insert_rowid() as id' - const result = await this.db.get(sql) - return result['id'] - } catch(err) { - throw err - } - } - /** * Retrieves details of an image * @param {Integer} key - id of the image diff --git a/unit tests/image.spec.js b/unit tests/image.spec.js index 0adbb0e..5a01cbf 100644 --- a/unit tests/image.spec.js +++ b/unit tests/image.spec.js @@ -39,15 +39,6 @@ describe('add()', () => { }) }) -describe('replace()', () => { - test('return error if filename is empty', async done => { - expect.assertions(1) - const image = await new Image() - await expect(image.replace('')) - .rejects.toEqual(Error('filename is missing')) - done() - }) -}) describe('get()', () => { test('return error if parameters are not stated', async done => {