diff --git a/lib/shared/store.js b/lib/shared/store.js index 24700bf1..797c5a98 100644 --- a/lib/shared/store.js +++ b/lib/shared/store.js @@ -168,8 +168,7 @@ const storeReducer = (state = DEFAULT_STATE, action) => { }) } - // Convert object instances to plain objects - const drives = JSON.parse(JSON.stringify(action.data)) + const drives = action.data if (!_.isArray(drives) || !_.every(drives, _.isPlainObject)) { throw errors.createError({ diff --git a/tests/shared/models/available-drives.spec.js b/tests/shared/models/available-drives.spec.js index 67f6b000..7c33bc85 100644 --- a/tests/shared/models/available-drives.spec.js +++ b/tests/shared/models/available-drives.spec.js @@ -77,31 +77,6 @@ describe('Model: availableDrives', function () { m.chai.expect(availableDrives.getDrives()).to.deep.equal(drives) }) - it('should be able to set non-plain drive objects', function () { - class Device { - constructor () { - this.device = '/dev/sdb' - this.description = 'Foo' - this.mountpoints = [ { - path: '/mnt/foo' - } ] - this.isSystem = false - } - } - - availableDrives.setDrives([ new Device() ]) - m.chai.expect(availableDrives.getDrives()).to.deep.equal([ - { - device: '/dev/sdb', - description: 'Foo', - mountpoints: [ { - path: '/mnt/foo' - } ], - isSystem: false - } - ]) - }) - it('should be able to set drives with extra properties', function () { const drives = [ {