minifix: remove stale json object plainifying in store

Change-Type: patch
Changelog-Entry: Remove stale JSON object plainifying in store
This commit is contained in:
Benedict Aas 2018-03-09 13:16:33 +00:00
parent a83e397643
commit 82b65399af
2 changed files with 1 additions and 27 deletions

View File

@ -165,8 +165,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({

View File

@ -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 = [
{