mirror of
https://github.com/balena-io/etcher.git
synced 2025-07-23 11:16:39 +00:00
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:
parent
a83e397643
commit
82b65399af
@ -165,8 +165,7 @@ const storeReducer = (state = DEFAULT_STATE, action) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert object instances to plain objects
|
const drives = action.data
|
||||||
const drives = JSON.parse(JSON.stringify(action.data))
|
|
||||||
|
|
||||||
if (!_.isArray(drives) || !_.every(drives, _.isPlainObject)) {
|
if (!_.isArray(drives) || !_.every(drives, _.isPlainObject)) {
|
||||||
throw errors.createError({
|
throw errors.createError({
|
||||||
|
@ -77,31 +77,6 @@ describe('Model: availableDrives', function () {
|
|||||||
m.chai.expect(availableDrives.getDrives()).to.deep.equal(drives)
|
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 () {
|
it('should be able to set drives with extra properties', function () {
|
||||||
const drives = [
|
const drives = [
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user