All files / main/ipc settingsUpdateRequest.ts

100% Statements 6/6
100% Branches 4/4
100% Functions 1/1
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15      3x 6x 1x     5x 3x     2x    
import type { AppSettings } from '@shared/types'
import { isPlainObject } from '@shared/settingsValidation'
 
export const getSettingsUpdatePatch = (request: unknown): Partial<AppSettings> => {
  if (!isPlainObject(request)) {
    throw new Error('settings.update request must be an object')
  }
 
  if (!isPlainObject(request.patch)) {
    throw new Error('settings.update patch must be a plain object')
  }
 
  return request.patch as Partial<AppSettings>
}