mirror of
https://github.com/balena-io/etcher.git
synced 2025-04-24 15:27:17 +00:00
Merge pull request #2111 from resin-io/store-efficient-plainify
minifix: remove stale json object plainifying in store
This commit is contained in:
commit
c5b311359a
@ -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({
|
||||
|
@ -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 = [
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user