maxgui/src/components/common/DetailsPage/__tests__/DetailsParametersTable.spec.js
/**
 * This function conditionally compare two object values with provided key names
 * @param {Object} resourceParam parameter that has been processed
 * @param {Object} moduleParam module parameter
 * @param {String} compareKey old unit suffix before updating
 */
This function conditionally compare two object values with provided key names
@param {Object} resourceParam parameter that has been processed
@param {Object} moduleParam module parameter
@param {String} compareKey old unit suffix before updating
This function conditionally compare two object values with provided key names @param { Object } resourceParam parameter that has been processed @param { Object } moduleParam module parameter @param { String } compareKey old unit suffix before updating
function compareParam(resourceParam, moduleParam, moduleParamKey) {
    switch (moduleParamKey) {
        case 'name':
            expect(resourceParam['id']).to.be.equal(moduleParam[moduleParamKey])
            break
        case 'modifiable':
            if (!moduleParam.modifiable) {
                expect(resourceParam['disabled']).to.be.equal(true)
            }
            break
        case 'enum_values':
            expect(resourceParam[moduleParamKey]).to.be.deep.equal(moduleParam[moduleParamKey])
            break
        default:
            expect(resourceParam[moduleParamKey]).to.be.equal(moduleParam[moduleParamKey])
            break
    }
    const hasModifiable = 'modifiable' in moduleParam
    if (!hasModifiable) {
        expect(resourceParam['disabled']).to.be.equal(false)
    }
}
function compareParam ( resourceParam , moduleParam , moduleParamKey ) { switch ( moduleParamKey ) { case 'name' : expect ( resourceParam [ 'id' ] ) . to . be . equal ( moduleParam [ moduleParamKey ] ) break case 'modifiable' : if ( ! moduleParam . modifiable ) { expect ( resourceParam [ 'disabled' ] ) . to . be . equal ( true ) } break case 'enum_values' : expect ( resourceParam [ moduleParamKey ] ) . to . be . deep . equal ( moduleParam [ moduleParamKey ] ) break default : expect ( resourceParam [ moduleParamKey ] ) . to . be . equal ( moduleParam [ moduleParamKey ] ) break } const hasModifiable = 'modifiable' in moduleParam if ( ! hasModifiable ) { expect ( resourceParam [ 'disabled' ] ) . to . be . equal ( false ) } }
This function conditionally compare two object values with provided key names
 @param {Object} resourceParam parameter that has been processed
 @param {Object} moduleParam module parameter
 @param {String} compareKey old unit suffix before updating
This function conditionally compare two object values with provided key names @param { Object } resourceParam parameter that has been processed @param { Object } moduleParam module parameter @param { String } compareKey old unit suffix before updating
// resourceParam process by table use id instead of name // resourceParam process by table use id instead of name // if module parameter doesn't have modifiable attribute, disabled should be false