test/unit/services.platform-menu.js
import test from 'ava';
import sinon from 'sinon';
import { client, PlatformMenu, platformMenuService } from '../../src';
test.before('start server', () => {
client.apiBaseUrl = 'https://somesite.Clinical6.com';
});
test.after('server shut down', () => {});
test.beforeEach((t) => {
client.cache = 'never';
client.authToken = 'valid_token';
t.context.server = sinon.fakeServer.create();
t.context.server.autoRespond = true;
client.storageUtility.clear('menus');
t.context.server.respondWith('DELETE', `${client.apiBaseUrl}/v3/menus/*`,
[200, { 'Content-Type': 'application/json' }, JSON.stringify({ status: 'ok' })]);
t.context.server.respondWith('GET', `${client.apiBaseUrl}/v3/menus`,
[200, { 'Content-Type': 'application/json' }, JSON.stringify({
data: [
// {
// id: '30',
// type: 'menus',
// attributes: {
// icon: 'icon-exchange',
// title: 'ENROLL',
// position: 0,
// enabled: false,
// url: '#',
// access_class: null
// },
// relationships: {
// parent: {
// data: null
// },
// authorizable: {
// data: null
// },
// children: {
// data: [
// {
// id: '31',
// type: 'menus'
// },
// {
// id: '32',
// type: 'menus'
// },
// {
// id: '33',
// type: 'menus'
// },
// {
// id: '34',
// type: 'menus'
// }
// ]
// }
// }
// },
// {
// id: '31',
// type: 'menus',
// attributes: {
// icon: 'icon-file-alt',
// title: 'Qualify - Core',
// position: 0,
// enabled: false,
// url: '/data_collection/flow_processes/qualify_core',
// access_class: 'qualify_core'
// },
// relationships: {
// parent: {
// data: {
// id: '30',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '32',
// type: 'menus',
// attributes: {
// icon: 'icon-file-alt',
// title: 'Consent - Core',
// position: 1,
// enabled: false,
// url: '/data_collection/flow_processes/Consent_core',
// access_class: 'Consent_core'
// },
// relationships: {
// parent: {
// data: {
// id: '30',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '33',
// type: 'menus',
// attributes: {
// icon: 'icon-file-alt',
// title: 'eQuiz - Core',
// position: 2,
// enabled: false,
// url: '/data_collection/flow_processes/equiz_core',
// access_class: 'equiz_core'
// },
// relationships: {
// parent: {
// data: {
// id: '30',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '34',
// type: 'menus',
// attributes: {
// icon: 'icon-bar-chart',
// title: 'Enrollment Insights',
// position: 3,
// enabled: false,
// url: '/static/enrollment_insights',
// access_class: null
// },
// relationships: {
// parent: {
// data: {
// id: '30',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
{
id: '35',
type: 'menus',
attributes: {
icon: 'icon-reorder',
title: 'ENGAGE',
position: 1,
enabled: true,
url: '#',
access_class: null
},
relationships: {
parent: {
data: null
},
authorizable: {
data: null
},
children: {
data: [
{
id: '36',
type: 'menus'
},
// {
// id: '43',
// type: 'menus'
// },
// {
// id: '50',
// type: 'menus'
// },
// {
// id: '52',
// type: 'menus'
// }
]
}
}
},
{
id: '36',
type: 'menus',
attributes: {
icon: 'icon-user-md',
title: 'Patient Notification',
position: 0,
enabled: false,
url: '#',
access_class: null
},
relationships: {
parent: {
data: {
id: '35',
type: 'menus'
}
},
authorizable: {
data: null
},
children: {
data: [
// {
// id: '37',
// type: 'menus'
// },
// {
// id: '38',
// type: 'menus'
// },
// {
// id: '39',
// type: 'menus'
// },
// {
// id: '40',
// type: 'menus'
// },
// {
// id: '41',
// type: 'menus'
// },
// {
// id: '42',
// type: 'menus'
// }
]
}
}
},
// {
// id: '37',
// type: 'menus',
// attributes: {
// icon: 'icon-bullhorn',
// title: 'Flash / Push Message',
// position: 0,
// enabled: false,
// url: '/gamifications/flash_messages',
// access_class: 'PushMessage'
// },
// relationships: {
// parent: {
// data: {
// id: '36',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '38',
// type: 'menus',
// attributes: {
// icon: 'icon-bell',
// title: 'Manage Notifications',
// position: 1,
// enabled: false,
// url: '/message_center/notifications',
// access_class: 'PushMessage'
// },
// relationships: {
// parent: {
// data: {
// id: '36',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '39',
// type: 'menus',
// attributes: {
// icon: 'icon-bullhorn',
// title: 'Advanced Filtering',
// position: 2,
// enabled: false,
// url: '/message_center/filter_push_messages',
// access_class: 'PushMessage'
// },
// relationships: {
// parent: {
// data: {
// id: '36',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '40',
// type: 'menus',
// attributes: {
// icon: 'icon-bell-alt',
// title: 'Reminders',
// position: 3,
// enabled: false,
// url: 'https://strimvelis.clinical6.com/admin/notification/templates',
// access_class: null
// },
// relationships: {
// parent: {
// data: {
// id: '36',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '41',
// type: 'menus',
// attributes: {
// icon: 'icon-bolt',
// title: 'Events & Alerts',
// position: 4,
// enabled: false,
// url: '/admin/callbacks',
// access_class: null
// },
// relationships: {
// parent: {
// data: {
// id: '36',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '42',
// type: 'menus',
// attributes: {
// icon: 'icon-globe',
// title: 'Proximity Alerts',
// position: 5,
// enabled: false,
// url: '/admin/proximity_alerts',
// access_class: null
// },
// relationships: {
// parent: {
// data: {
// id: '36',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '43',
// type: 'menus',
// attributes: {
// icon: 'icon-folder-close-alt',
// title: 'Trial Information',
// position: 1,
// enabled: true,
// url: '#',
// access_class: null
// },
// relationships: {
// parent: {
// data: {
// id: '35',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: [
// {
// id: '140',
// type: 'menus'
// },
// {
// id: '146',
// type: 'menus'
// },
// {
// id: '145',
// type: 'menus'
// },
// {
// id: '142',
// type: 'menus'
// },
// {
// id: '157',
// type: 'menus'
// },
// {
// id: '45',
// type: 'menus'
// },
// {
// id: '44',
// type: 'menus'
// },
// {
// id: '46',
// type: 'menus'
// },
// {
// id: '47',
// type: 'menus'
// },
// {
// id: '48',
// type: 'menus'
// },
// {
// id: '49',
// type: 'menus'
// }
// ]
// }
// }
// },
// {
// id: '140',
// type: 'menus',
// attributes: {
// icon: 'icon-question-sign',
// title: 'About the Study',
// position: 0,
// enabled: true,
// url: '/admin/cms/v2/about_the_study',
// access_class: 'about_the_study'
// },
// relationships: {
// parent: {
// data: {
// id: '43',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '146',
// type: 'menus',
// attributes: {
// icon: 'icon-question-sign',
// title: 'FAQs',
// position: 1,
// enabled: true,
// url: '/admin/cms/v2/faqs',
// access_class: 'faqs'
// },
// relationships: {
// parent: {
// data: {
// id: '43',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '145',
// type: 'menus',
// attributes: {
// icon: 'icon-question-sign',
// title: 'Glossary',
// position: 2,
// enabled: false,
// url: '/admin/cms/v2/glossary',
// access_class: 'glossary'
// },
// relationships: {
// parent: {
// data: {
// id: '43',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '142',
// type: 'menus',
// attributes: {
// icon: 'icon-question-sign',
// title: 'Technical Support',
// position: 3,
// enabled: true,
// url: '/admin/cms/v2/technical_support',
// access_class: 'technical_support'
// },
// relationships: {
// parent: {
// data: {
// id: '43',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '157',
// type: 'menus',
// attributes: {
// icon: 'icon-question-sign',
// title: 'Agreement Consent',
// position: 4,
// enabled: false,
// url: '/admin/cms/v2/agreement_consent',
// access_class: 'agreement_consent'
// },
// relationships: {
// parent: {
// data: {
// id: '43',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '45',
// type: 'menus',
// attributes: {
// icon: 'icon-question-sign',
// title: 'Key Terms',
// position: 5,
// enabled: false,
// url: '/admin/cms/v2/key_terms',
// access_class: 'key_terms'
// },
// relationships: {
// parent: {
// data: {
// id: '43',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '44',
// type: 'menus',
// attributes: {
// icon: 'icon-question-sign',
// title: 'Trial Info',
// position: 6,
// enabled: false,
// url: '/admin/cms/v2/faqs',
// access_class: 'faq'
// },
// relationships: {
// parent: {
// data: {
// id: '43',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '46',
// type: 'menus',
// attributes: {
// icon: 'icon-question-sign',
// title: 'New Info from Trial',
// position: 7,
// enabled: false,
// url: '/admin/cms/v2/nerw_info_from_trial',
// access_class: 'nerw_info_from_trial'
// },
// relationships: {
// parent: {
// data: {
// id: '43',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '47',
// type: 'menus',
// attributes: {
// icon: 'icon-film',
// title: 'Videos - Subject',
// position: 8,
// enabled: false,
// url: '/admin/cms/v2/videos',
// access_class: 'videos'
// },
// relationships: {
// parent: {
// data: {
// id: '43',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '48',
// type: 'menus',
// attributes: {
// icon: 'icon-film',
// title: 'Videos - Companion App',
// position: 9,
// enabled: false,
// url: '/admin/cms/v2/videos_care_circle',
// access_class: 'videos_care_circle'
// },
// relationships: {
// parent: {
// data: {
// id: '43',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '49',
// type: 'menus',
// attributes: {
// icon: 'icon-question-sign',
// title: 'Cycle Details',
// position: 10,
// enabled: false,
// url: '/admin/cms/v2/cycle_details',
// access_class: 'cycle_details'
// },
// relationships: {
// parent: {
// data: {
// id: '43',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '50',
// type: 'menus',
// attributes: {
// icon: 'icon-magic',
// title: 'Gamification',
// position: 2,
// enabled: false,
// url: '#',
// access_class: null
// },
// relationships: {
// parent: {
// data: {
// id: '35',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: [
// {
// id: '51',
// type: 'menus'
// }
// ]
// }
// }
// },
// {
// id: '51',
// type: 'menus',
// attributes: {
// icon: 'icon-asterisk',
// title: 'Badges',
// position: 0,
// enabled: false,
// url: '/admin/badges',
// access_class: null
// },
// relationships: {
// parent: {
// data: {
// id: '50',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '52',
// type: 'menus',
// attributes: {
// icon: 'icon-eye-open',
// title: 'Engagement Insights',
// position: 3,
// enabled: false,
// url: '/insights',
// access_class: 'InsightsTracker'
// },
// relationships: {
// parent: {
// data: {
// id: '35',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '53',
// type: 'menus',
// attributes: {
// icon: 'icon-user-md',
// title: 'CONSULT',
// position: 2,
// enabled: false,
// url: '#',
// access_class: null
// },
// relationships: {
// parent: {
// data: null
// },
// authorizable: {
// data: null
// },
// children: {
// data: [
// {
// id: '54',
// type: 'menus'
// }
// ]
// }
// }
// },
// {
// id: '54',
// type: 'menus',
// attributes: {
// icon: 'icon-facetime-video',
// title: 'Video Consult',
// position: 0,
// enabled: false,
// url: '/static/video_consult',
// access_class: null
// },
// relationships: {
// parent: {
// data: {
// id: '53',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '55',
// type: 'menus',
// attributes: {
// icon: 'icon-envelope',
// title: 'RECORD',
// position: 3,
// enabled: true,
// url: '#',
// access_class: null
// },
// relationships: {
// parent: {
// data: null
// },
// authorizable: {
// data: null
// },
// children: {
// data: [
// {
// id: '118',
// type: 'menus'
// },
// {
// id: '56',
// type: 'menus'
// },
// {
// id: '60',
// type: 'menus'
// }
// ]
// }
// }
// },
// {
// id: '118',
// type: 'menus',
// attributes: {
// icon: 'icon-pencil',
// title: 'Flow process',
// position: 0,
// enabled: true,
// url: '/data_collection/flow_processes',
// access_class: null
// },
// relationships: {
// parent: {
// data: {
// id: '55',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '56',
// type: 'menus',
// attributes: {
// icon: 'icon-pencil',
// title: 'ePROs',
// position: 1,
// enabled: false,
// url: '#',
// access_class: null
// },
// relationships: {
// parent: {
// data: {
// id: '55',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: [
// {
// id: '57',
// type: 'menus'
// },
// {
// id: '58',
// type: 'menus'
// },
// {
// id: '59',
// type: 'menus'
// }
// ]
// }
// }
// },
// {
// id: '57',
// type: 'menus',
// attributes: {
// icon: 'icon-file-alt',
// title: 'DTSQs - Core',
// position: 0,
// enabled: false,
// url: '/data_collection/flow_processes/dtsq_core',
// access_class: 'dtsq_core'
// },
// relationships: {
// parent: {
// data: {
// id: '56',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '58',
// type: 'menus',
// attributes: {
// icon: null,
// title: 'DTSQc - Core',
// position: 1,
// enabled: false,
// url: '/data_collection/flow_processes/dtsqc_core',
// access_class: 'dtsqc_core'
// },
// relationships: {
// parent: {
// data: {
// id: '56',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '59',
// type: 'menus',
// attributes: {
// icon: 'icon-check',
// title: 'ePRO Insights',
// position: 2,
// enabled: false,
// url: '/admin/survey_results',
// access_class: 'Survey'
// },
// relationships: {
// parent: {
// data: {
// id: '56',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '60',
// type: 'menus',
// attributes: {
// icon: 'icon-file-alt',
// title: 'Surveys',
// position: 2,
// enabled: false,
// url: '/admin/surveys',
// access_class: 'MobileUser'
// },
// relationships: {
// parent: {
// data: {
// id: '55',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '61',
// type: 'menus',
// attributes: {
// icon: 'icon-bar-chart',
// title: 'REPORT',
// position: 4,
// enabled: false,
// url: '#',
// access_class: null
// },
// relationships: {
// parent: {
// data: null
// },
// authorizable: {
// data: null
// },
// children: {
// data: [
// {
// id: '62',
// type: 'menus'
// },
// {
// id: '63',
// type: 'menus'
// },
// {
// id: '64',
// type: 'menus'
// },
// {
// id: '65',
// type: 'menus'
// },
// {
// id: '66',
// type: 'menus'
// },
// {
// id: '67',
// type: 'menus'
// },
// {
// id: '68',
// type: 'menus'
// },
// {
// id: '69',
// type: 'menus'
// }
// ]
// }
// }
// },
// {
// id: '62',
// type: 'menus',
// attributes: {
// icon: 'icon-map-marker',
// title: 'Geo Insights',
// position: 0,
// enabled: false,
// url: '/insights/geo_insights',
// access_class: 'InsightsTracker'
// },
// relationships: {
// parent: {
// data: {
// id: '61',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '63',
// type: 'menus',
// attributes: {
// icon: 'icon-group',
// title: 'Clinical6 EDC',
// position: 1,
// enabled: false,
// url: '/insights/consumer_insights2',
// access_class: 'MobileUser'
// },
// relationships: {
// parent: {
// data: {
// id: '61',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '64',
// type: 'menus',
// attributes: {
// icon: 'icon-user-md',
// title: 'Patient Insights',
// position: 2,
// enabled: false,
// url: '/cr_trials/patients',
// access_class: 'MobileUser'
// },
// relationships: {
// parent: {
// data: {
// id: '61',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '65',
// type: 'menus',
// attributes: {
// icon: 'icon-bell',
// title: 'Sites',
// position: 3,
// enabled: false,
// url: '/cr_trials/sites',
// access_class: null
// },
// relationships: {
// parent: {
// data: {
// id: '61',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '66',
// type: 'menus',
// attributes: {
// icon: 'icon-bell',
// title: 'Available Codes',
// position: 4,
// enabled: false,
// url: '/signable/rx_codes',
// access_class: null
// },
// relationships: {
// parent: {
// data: {
// id: '61',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '67',
// type: 'menus',
// attributes: {
// icon: 'icon-screenshot',
// title: 'Target Insights',
// position: 5,
// enabled: false,
// url: '/insights/target_insights',
// access_class: 'InsightsTracker'
// },
// relationships: {
// parent: {
// data: {
// id: '61',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '68',
// type: 'menus',
// attributes: {
// icon: 'icon-medkit',
// title: 'Symptoms',
// position: 6,
// enabled: false,
// url: '/admin/cms/v2/adverse_reporting',
// access_class: 'adverse_reporting'
// },
// relationships: {
// parent: {
// data: {
// id: '61',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '69',
// type: 'menus',
// attributes: {
// icon: 'icon-medkit',
// title: 'Event Reporting',
// position: 7,
// enabled: false,
// url: '/admin/cms/v2/adverse_reporting',
// access_class: 'adverse_reporting'
// },
// relationships: {
// parent: {
// data: {
// id: '61',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '70',
// type: 'menus',
// attributes: {
// icon: 'icon-key',
// title: 'ADMIN',
// position: 5,
// enabled: true,
// url: '#',
// access_class: null
// },
// relationships: {
// parent: {
// data: null
// },
// authorizable: {
// data: null
// },
// children: {
// data: [
// {
// id: '71',
// type: 'menus'
// },
// {
// id: '72',
// type: 'menus'
// },
// {
// id: '77',
// type: 'menus'
// },
// {
// id: '101',
// type: 'menus'
// },
// {
// id: '106',
// type: 'menus'
// },
// {
// id: '110',
// type: 'menus'
// },
// {
// id: '114',
// type: 'menus'
// }
// ]
// }
// }
// },
// {
// id: '71',
// type: 'menus',
// attributes: {
// icon: 'icon-desktop',
// title: 'Custom Content Types',
// position: 0,
// enabled: true,
// url: '/admin/content_types',
// access_class: 'DynamicContent::ContentType'
// },
// relationships: {
// parent: {
// data: {
// id: '70',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '72',
// type: 'menus',
// attributes: {
// icon: 'icon-external-link',
// title: 'ReachLink',
// position: 1,
// enabled: false,
// url: '#',
// access_class: null
// },
// relationships: {
// parent: {
// data: {
// id: '70',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: [
// {
// id: '73',
// type: 'menus'
// },
// {
// id: '74',
// type: 'menus'
// },
// {
// id: '75',
// type: 'menus'
// },
// {
// id: '76',
// type: 'menus'
// }
// ]
// }
// }
// },
// {
// id: '73',
// type: 'menus',
// attributes: {
// icon: 'icon-retweet',
// title: 'External API Connector',
// position: 0,
// enabled: false,
// url: '/oauth/applications',
// access_class: 'oauth_application'
// },
// relationships: {
// parent: {
// data: {
// id: '72',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '74',
// type: 'menus',
// attributes: {
// icon: 'icon-link',
// title: 'Integration Targets',
// position: 1,
// enabled: false,
// url: '#',
// access_class: null
// },
// relationships: {
// parent: {
// data: {
// id: '72',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '75',
// type: 'menus',
// attributes: {
// icon: 'icon-download',
// title: 'Data Source Manager',
// position: 2,
// enabled: false,
// url: '/reach_link/data_source_manager',
// access_class: 'DynamicContent::ContentType'
// },
// relationships: {
// parent: {
// data: {
// id: '72',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '76',
// type: 'menus',
// attributes: {
// icon: 'icon-resize-horizontal',
// title: 'EDC Link',
// position: 3,
// enabled: false,
// url: '/admin/rave_web_services',
// access_class: null
// },
// relationships: {
// parent: {
// data: {
// id: '72',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '77',
// type: 'menus',
// attributes: {
// icon: 'icon-cog',
// title: 'App Config',
// position: 2,
// enabled: true,
// url: '#',
// access_class: null
// },
// relationships: {
// parent: {
// data: {
// id: '70',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: [
// {
// id: '78',
// type: 'menus'
// },
// {
// id: '79',
// type: 'menus'
// },
// {
// id: '99',
// type: 'menus'
// },
// {
// id: '100',
// type: 'menus'
// }
// ]
// }
// }
// },
// {
// id: '78',
// type: 'menus',
// attributes: {
// icon: 'icon-tasks',
// title: 'Mobile Menus',
// position: 0,
// enabled: true,
// url: '/admin/cms/mobile_menus',
// access_class: 'Cms::MobileMenu'
// },
// relationships: {
// parent: {
// data: {
// id: '77',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '79',
// type: 'menus',
// attributes: {
// icon: 'icon-th',
// title: 'Create CMS Modules',
// position: 1,
// enabled: true,
// url: '/admin/content_types/',
// access_class: 'DynamicContent::ContentType'
// },
// relationships: {
// parent: {
// data: {
// id: '77',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: [
// {
// id: '80',
// type: 'menus'
// },
// {
// id: '81',
// type: 'menus'
// },
// {
// id: '82',
// type: 'menus'
// },
// {
// id: '83',
// type: 'menus'
// },
// {
// id: '84',
// type: 'menus'
// },
// {
// id: '85',
// type: 'menus'
// },
// {
// id: '86',
// type: 'menus'
// },
// {
// id: '87',
// type: 'menus'
// },
// {
// id: '88',
// type: 'menus'
// },
// {
// id: '89',
// type: 'menus'
// },
// {
// id: '90',
// type: 'menus'
// },
// {
// id: '91',
// type: 'menus'
// },
// {
// id: '92',
// type: 'menus'
// },
// {
// id: '93',
// type: 'menus'
// },
// {
// id: '94',
// type: 'menus'
// },
// {
// id: '95',
// type: 'menus'
// },
// {
// id: '96',
// type: 'menus'
// },
// {
// id: '97',
// type: 'menus'
// },
// {
// id: '98',
// type: 'menus'
// },
// {
// id: '120',
// type: 'menus'
// },
// {
// id: '131',
// type: 'menus'
// },
// {
// id: '133',
// type: 'menus'
// },
// {
// id: '143',
// type: 'menus'
// },
// {
// id: '147',
// type: 'menus'
// },
// {
// id: '149',
// type: 'menus'
// },
// {
// id: '150',
// type: 'menus'
// },
// {
// id: '151',
// type: 'menus'
// },
// {
// id: '180',
// type: 'menus'
// }
// ]
// }
// }
// },
// {
// id: '80',
// type: 'menus',
// attributes: {
// icon: 'icon-question-sign',
// title: 'Flow process',
// position: 0,
// enabled: true,
// url: '/admin/cms/v2/flow_process',
// access_class: 'flow_process'
// },
// relationships: {
// parent: {
// data: {
// id: '79',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '81',
// type: 'menus',
// attributes: {
// icon: 'icon-question-sign',
// title: 'Welcome',
// position: 1,
// enabled: true,
// url: '/admin/cms/v2/welcome',
// access_class: 'welcome'
// },
// relationships: {
// parent: {
// data: {
// id: '79',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '82',
// type: 'menus',
// attributes: {
// icon: 'icon-question-sign',
// title: 'Qualification',
// position: 2,
// enabled: true,
// url: '/admin/cms/v2/qualification',
// access_class: 'qualification'
// },
// relationships: {
// parent: {
// data: {
// id: '79',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '83',
// type: 'menus',
// attributes: {
// icon: 'icon-question-sign',
// title: 'Qualification Result',
// position: 3,
// enabled: true,
// url: '/admin/cms/v2/qualification_result',
// access_class: 'qualification_result'
// },
// relationships: {
// parent: {
// data: {
// id: '79',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '84',
// type: 'menus',
// attributes: {
// icon: 'icon-question-sign',
// title: 'Qualify',
// position: 4,
// enabled: true,
// url: '/admin/cms/v2/qualify',
// access_class: 'qualify'
// },
// relationships: {
// parent: {
// data: {
// id: '79',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '85',
// type: 'menus',
// attributes: {
// icon: 'icon-question-sign',
// title: 'Error',
// position: 5,
// enabled: true,
// url: '/admin/cms/v2/error',
// access_class: 'error'
// },
// relationships: {
// parent: {
// data: {
// id: '79',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '86',
// type: 'menus',
// attributes: {
// icon: 'icon-beaker',
// title: 'Lab Reports',
// position: 6,
// enabled: true,
// url: '/admin/cms/v2/lab_reports',
// access_class: 'lab_reports'
// },
// relationships: {
// parent: {
// data: {
// id: '79',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '87',
// type: 'menus',
// attributes: {
// icon: 'icon-question-sign',
// title: 'Consent',
// position: 7,
// enabled: true,
// url: '/admin/cms/v2/consent',
// access_class: 'consent'
// },
// relationships: {
// parent: {
// data: {
// id: '79',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '88',
// type: 'menus',
// attributes: {
// icon: 'icon-question-sign',
// title: 'Learn More',
// position: 8,
// enabled: true,
// url: '/admin/cms/v2/learn_more',
// access_class: 'learn_more'
// },
// relationships: {
// parent: {
// data: {
// id: '79',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '89',
// type: 'menus',
// attributes: {
// icon: 'icon-question-sign',
// title: 'Answer Incorrect',
// position: 9,
// enabled: true,
// url: '/admin/cms/v2/answer_incorrect',
// access_class: 'answer_incorrect'
// },
// relationships: {
// parent: {
// data: {
// id: '79',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '90',
// type: 'menus',
// attributes: {
// icon: 'icon-question-sign',
// title: 'Final Agreement',
// position: 10,
// enabled: true,
// url: '/admin/cms/v2/final_agreement',
// access_class: 'final_agreement'
// },
// relationships: {
// parent: {
// data: {
// id: '79',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '91',
// type: 'menus',
// attributes: {
// icon: 'icon-question-sign',
// title: 'FAQ',
// position: 11,
// enabled: true,
// url: '/admin/cms/v2/faq',
// access_class: 'faq'
// },
// relationships: {
// parent: {
// data: {
// id: '79',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '92',
// type: 'menus',
// attributes: {
// icon: 'icon-hand-right',
// title: 'Key Terms',
// position: 12,
// enabled: true,
// url: '/admin/cms/v2/key_terms',
// access_class: 'key_terms'
// },
// relationships: {
// parent: {
// data: {
// id: '79',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '93',
// type: 'menus',
// attributes: {
// icon: 'icon-pencil',
// title: 'Signature',
// position: 13,
// enabled: true,
// url: '/admin/cms/v2/signature',
// access_class: 'signature'
// },
// relationships: {
// parent: {
// data: {
// id: '79',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '94',
// type: 'menus',
// attributes: {
// icon: 'icon-question-sign',
// title: 'Sites',
// position: 14,
// enabled: true,
// url: '/admin/cms/v2/sites',
// access_class: 'sites'
// },
// relationships: {
// parent: {
// data: {
// id: '79',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '95',
// type: 'menus',
// attributes: {
// icon: 'icon-edit',
// title: 'ePRO',
// position: 15,
// enabled: true,
// url: '/admin/cms/v2/epro',
// access_class: 'epro'
// },
// relationships: {
// parent: {
// data: {
// id: '79',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '96',
// type: 'menus',
// attributes: {
// icon: 'icon-question-sign',
// title: 'Videos',
// position: 16,
// enabled: true,
// url: '/admin/cms/v2/videos',
// access_class: 'videos'
// },
// relationships: {
// parent: {
// data: {
// id: '79',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '97',
// type: 'menus',
// attributes: {
// icon: 'icon-question-sign',
// title: 'Site Content',
// position: 17,
// enabled: true,
// url: '/admin/cms/v2/site_content',
// access_class: 'site_content'
// },
// relationships: {
// parent: {
// data: {
// id: '79',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '98',
// type: 'menus',
// attributes: {
// icon: 'icon-bar-chart',
// title: 'Event Report',
// position: 18,
// enabled: true,
// url: '/admin/cms/v2/event_report',
// access_class: 'event_report'
// },
// relationships: {
// parent: {
// data: {
// id: '79',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '120',
// type: 'menus',
// attributes: {
// icon: 'icon-ok',
// title: 'Data Collection',
// position: 19,
// enabled: true,
// url: '/admin/cms/v2/data_collection',
// access_class: 'data_collection'
// },
// relationships: {
// parent: {
// data: {
// id: '79',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '131',
// type: 'menus',
// attributes: {
// icon: 'icon-question-sign',
// title: 'Final Agreement',
// position: 20,
// enabled: true,
// url: '/admin/cms/v2/final_agreement',
// access_class: 'final_agreement'
// },
// relationships: {
// parent: {
// data: {
// id: '79',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '133',
// type: 'menus',
// attributes: {
// icon: 'icon-hand-right',
// title: 'Key Terms',
// position: 21,
// enabled: true,
// url: '/admin/cms/v2/key_terms',
// access_class: 'key_terms'
// },
// relationships: {
// parent: {
// data: {
// id: '79',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '143',
// type: 'menus',
// attributes: {
// icon: 'icon-question-sign',
// title: 'Contact',
// position: 22,
// enabled: true,
// url: '/admin/cms/v2/contact',
// access_class: 'contact'
// },
// relationships: {
// parent: {
// data: {
// id: '79',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '147',
// type: 'menus',
// attributes: {
// icon: 'icon-question-sign',
// title: 'Manage Lists',
// position: 23,
// enabled: true,
// url: '/admin/cms/v2/manage_lists',
// access_class: 'manage_lists'
// },
// relationships: {
// parent: {
// data: {
// id: '79',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '149',
// type: 'menus',
// attributes: {
// icon: 'icon-question-sign',
// title: 'Edit Item',
// position: 24,
// enabled: true,
// url: '/admin/cms/v2/edit_item',
// access_class: 'edit_item'
// },
// relationships: {
// parent: {
// data: {
// id: '79',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '150',
// type: 'menus',
// attributes: {
// icon: 'icon-question-sign',
// title: 'upload_via_camera',
// position: 25,
// enabled: true,
// url: '/admin/cms/v2/upload_via_camera',
// access_class: 'upload_via_camera'
// },
// relationships: {
// parent: {
// data: {
// id: '79',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '151',
// type: 'menus',
// attributes: {
// icon: 'icon-question-sign',
// title: 'Upload Via Mail',
// position: 26,
// enabled: true,
// url: '/admin/cms/v2/upload_via_mail',
// access_class: 'upload_via_mail'
// },
// relationships: {
// parent: {
// data: {
// id: '79',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '180',
// type: 'menus',
// attributes: {
// icon: 'icon-beaker',
// title: 'Test Content',
// position: 27,
// enabled: true,
// url: '/admin/cms/v2/test_content',
// access_class: 'test_content'
// },
// relationships: {
// parent: {
// data: {
// id: '79',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '99',
// type: 'menus',
// attributes: {
// icon: 'icon-ban-circle',
// title: 'Mobile Apps',
// position: 2,
// enabled: false,
// url: '#',
// access_class: null
// },
// relationships: {
// parent: {
// data: {
// id: '77',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '100',
// type: 'menus',
// attributes: {
// icon: 'icon-picture',
// title: 'Image Manager',
// position: 3,
// enabled: true,
// url: '/admin/image_managers',
// access_class: 'ImageManager'
// },
// relationships: {
// parent: {
// data: {
// id: '77',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '101',
// type: 'menus',
// attributes: {
// icon: 'icon-medkit',
// title: 'Trial Config',
// position: 3,
// enabled: true,
// url: '#',
// access_class: null
// },
// relationships: {
// parent: {
// data: {
// id: '70',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: [
// {
// id: '102',
// type: 'menus'
// },
// {
// id: '103',
// type: 'menus'
// },
// {
// id: '104',
// type: 'menus'
// },
// {
// id: '105',
// type: 'menus'
// }
// ]
// }
// }
// },
// {
// id: '102',
// type: 'menus',
// attributes: {
// icon: 'icon-map-marker',
// title: 'Locations',
// position: 0,
// enabled: true,
// url: '/admin/locations',
// access_class: 'Location'
// },
// relationships: {
// parent: {
// data: {
// id: '101',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '103',
// type: 'menus',
// attributes: {
// icon: 'icon-flag',
// title: 'Languages',
// position: 1,
// enabled: true,
// url: '/admin/languages',
// access_class: null
// },
// relationships: {
// parent: {
// data: {
// id: '101',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '104',
// type: 'menus',
// attributes: {
// icon: 'icon-copy',
// title: 'Translations',
// position: 2,
// enabled: true,
// url: '/admin/translations',
// access_class: null
// },
// relationships: {
// parent: {
// data: {
// id: '101',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '105',
// type: 'menus',
// attributes: {
// icon: 'icon-tags',
// title: 'Tags',
// position: 3,
// enabled: true,
// url: '/admin/tags',
// access_class: 'Tag'
// },
// relationships: {
// parent: {
// data: {
// id: '101',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '106',
// type: 'menus',
// attributes: {
// icon: 'icon-group',
// title: 'User Config',
// position: 4,
// enabled: true,
// url: '#',
// access_class: null
// },
// relationships: {
// parent: {
// data: {
// id: '70',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: [
// {
// id: '107',
// type: 'menus'
// },
// {
// id: '108',
// type: 'menus'
// },
// {
// id: '109',
// type: 'menus'
// }
// ]
// }
// }
// },
// {
// id: '107',
// type: 'menus',
// attributes: {
// icon: 'icon-user-md',
// title: 'Users',
// position: 0,
// enabled: true,
// url: '/admin/users',
// access_class: 'User'
// },
// relationships: {
// parent: {
// data: {
// id: '106',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '108',
// type: 'menus',
// attributes: {
// icon: 'icon-plus-sign-alt',
// title: 'User Roles',
// position: 1,
// enabled: true,
// url: '/admin/user_roles',
// access_class: 'UserRole'
// },
// relationships: {
// parent: {
// data: {
// id: '106',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '109',
// type: 'menus',
// attributes: {
// icon: 'icon-user',
// title: 'User Profile Settings',
// position: 2,
// enabled: true,
// url: '/admin/profile_attributes',
// access_class: 'ProfileAttribute'
// },
// relationships: {
// parent: {
// data: {
// id: '106',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '110',
// type: 'menus',
// attributes: {
// icon: 'icon-desktop',
// title: 'Portal Config',
// position: 5,
// enabled: true,
// url: '#',
// access_class: null
// },
// relationships: {
// parent: {
// data: {
// id: '70',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: [
// {
// id: '111',
// type: 'menus'
// },
// {
// id: '112',
// type: 'menus'
// },
// {
// id: '113',
// type: 'menus'
// }
// ]
// }
// }
// },
// {
// id: '111',
// type: 'menus',
// attributes: {
// icon: 'icon-cogs',
// title: 'Portal',
// position: 0,
// enabled: true,
// url: '/admin/settings',
// access_class: 'configuration'
// },
// relationships: {
// parent: {
// data: {
// id: '110',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '112',
// type: 'menus',
// attributes: {
// icon: 'icon-tasks',
// title: 'Modules',
// position: 1,
// enabled: true,
// url: '/admin/modules',
// access_class: 'Section'
// },
// relationships: {
// parent: {
// data: {
// id: '110',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '113',
// type: 'menus',
// attributes: {
// icon: 'icon-ban-circle',
// title: 'Devices',
// position: 2,
// enabled: false,
// url: '#',
// access_class: null
// },
// relationships: {
// parent: {
// data: {
// id: '110',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '114',
// type: 'menus',
// attributes: {
// icon: 'icon-legal',
// title: 'Compliance',
// position: 6,
// enabled: true,
// url: '#',
// access_class: null
// },
// relationships: {
// parent: {
// data: {
// id: '70',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: [
// {
// id: '115',
// type: 'menus'
// },
// {
// id: '117',
// type: 'menus'
// },
// {
// id: '154',
// type: 'menus'
// }
// ]
// }
// }
// },
// {
// id: '115',
// type: 'menus',
// attributes: {
// icon: 'icon-file-alt',
// title: 'API Documentation',
// position: 0,
// enabled: true,
// url: '/api-doc',
// access_class: 'api_doc'
// },
// relationships: {
// parent: {
// data: {
// id: '114',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '117',
// type: 'menus',
// attributes: {
// icon: 'icon-stethoscope',
// title: 'Debug Log',
// position: 1,
// enabled: true,
// url: '/admin/log',
// access_class: 'Log::Entry'
// },
// relationships: {
// parent: {
// data: {
// id: '114',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '154',
// type: 'menus',
// attributes: {
// icon: 'icon-folder-close-alt',
// title: 'Audit Trail',
// position: 2,
// enabled: true,
// url: '/ui/audits',
// access_class: null
// },
// relationships: {
// parent: {
// data: {
// id: '114',
// type: 'menus'
// }
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// }
]
})]);
// t.context.server.respondWith('GET', `${client.apiBaseUrl}/v3/menus`,
// [200, { 'Content-Type': 'application/json' }, JSON.stringify({
// data: [
// {
// id: '324',
// type: 'menus',
// attributes: {
// icon: 'icon-star',
// title: 'vitae',
// position: 1,
// enabled: true,
// url: '#',
// access_class: null
// },
// relationships: {
// parent: {
// data: null
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '325',
// type: 'menus',
// attributes: {
// icon: 'icon-star',
// title: 'vitae',
// position: 2,
// enabled: true,
// url: '#',
// access_class: null
// },
// relationships: {
// parent: {
// data: null
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '326',
// type: 'menus',
// attributes: {
// icon: 'icon-star',
// title: 'vitae',
// position: 3,
// enabled: true,
// url: '#',
// access_class: null
// },
// relationships: {
// parent: {
// data: null
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// },
// {
// id: '327',
// type: 'menus',
// attributes: {
// icon: 'icon-star',
// title: 'vitae',
// position: 4,
// enabled: true,
// url: '#',
// access_class: null
// },
// relationships: {
// parent: {
// data: null
// },
// authorizable: {
// data: null
// },
// children: {
// data: []
// }
// }
// }
// ]
// })]
// );
t.context.server.respondWith('GET', `${client.apiBaseUrl}/v3/menus/*`,
[200, { 'Content-Type': 'application/json' }, JSON.stringify({
data: {
id: '319',
type: 'menus',
attributes: {
icon: 'icon-star',
title: 'vitae',
position: 1,
enabled: true,
url: '#',
access_class: null
},
relationships: {
parent: {
data: null
},
authorizable: {
data: null
},
children: {
data: []
}
}
}
})]);
t.context.server.respondWith('POST', `${client.apiBaseUrl}/v3/menus`,
[201, { 'Content-Type': 'application/json' }, JSON.stringify({
data: {
id: '322',
type: 'menus',
attributes: {
icon: 'icon-star',
title: 'vitae',
position: 2,
enabled: true,
url: '#',
access_class: null
},
relationships: {
parent: {
data: null
},
authorizable: {
data: null
},
children: {
data: []
}
}
}
})]);
t.context.server.respondWith('PATCH', `${client.apiBaseUrl}/v3/menus/*`,
[200, { 'Content-Type': 'application/json' }, JSON.stringify({
data: {
id: '330',
type: 'menus',
attributes: {
icon: 'icon-star',
title: 'vitae',
position: 1,
enabled: true,
url: '#',
access_class: null
},
relationships: {
parent: {
data: null
},
authorizable: {
data: null
},
children: {
data: []
}
}
}
})]);
t.context.storage = client.storageUtility;
client.platformMenu = new PlatformMenu({});
t.context.platformMenuJsonApi = {
data: {
id: 330,
type: 'menus',
attributes: {
url: '2'
}
}
};
t.context.platformMenu = new PlatformMenu(t.context.platformMenuJsonApi);
});
test.afterEach(t => t.context.server.restore());
// PlatformMenuService.delete method
/**
* @test {PlatformMenuService.delete}
*/
test('[unit] PlatformMenuService.delete should exist', (t) => {
t.truthy(platformMenuService.delete);
});
/**
* @test {PlatformMenuService.delete}
*/
test('[unit] PlatformMenuService.delete should throw errors for invalid parameters', async (t) => {
const title = `PlatformMenuService.delete error`;
await t.throwsAsync(platformMenuService.delete(), `${title}: platformMenu is not defined`);
});
// /**
// * @test {PlatformMenuService.delete}
// */
// test('[unit] PlatformMenuService.delete should make a properly formatted delete request', async (t) => {
// const { platformMenu } = t.context;
// platformMenu.id = 5;
// await platformMenuService.delete(platformMenu);
// const request = t.context.server.requests[0];
// t.is(request.method, 'DELETE');
// t.is(request.url, `${client.apiBaseUrl}/v3/menus/${platformMenu.id}`);
// t.is(request.requestHeaders.Accept, 'application/json');
// t.is(request.requestHeaders['Content-Type'], 'application/json;charset=utf-8');
// t.is(request.requestHeaders.Authorization, 'Token token=valid_token');
// });
/**
* @test {PlatformMenuService.delete}
*/
test('[unit] PlatformMenuService.delete should receive a valid response for a delete request', async (t) => {
const { platformMenu } = t.context;
platformMenu.id = 5;
const response = await platformMenuService.delete(platformMenu);
// const request = t.context.server.requests[0];
// t.is(request.requestHeaders.Authorization, 'Token token=valid_token');
t.truthy(response);
});
/**
* @test {PlatformMenuService.delete}
*/
test('[unit] PlatformMenuService.delete should remove the element from local storage', async (t) => {
const { platformMenu, storage } = t.context;
platformMenu.id = 5;
await storage.set('menus', platformMenu.toJSON(), { id: platformMenu.id });
await platformMenuService.delete(platformMenu);
t.is(storage.has('menus', { id: platformMenu.id }), false);
});
// PlatformMenuService.get method
/**
* @test {PlatformMenuService.get}
*/
test('[unit] PlatformMenuService.get should exist', (t) => {
t.truthy(platformMenuService.get);
});
/**
* @test {PlatformMenuService.get}
*/
test.serial('[unit] PlatformMenuService.get should throw an error when there is no authToken', async (t) => {
client.authToken = undefined;
const expectedError = 'PlatformMenuService.get error: requires authToken';
await t.throwsAsync(platformMenuService.get(), expectedError);
});
// /**
// * @test {PlatformMenuService.get}
// */
// test('[unit] PlatformMenuService.get should make a properly formatted get request', async (t) => {
// await platformMenuService.get();
// const request = t.context.server.requests[0];
// t.is(request.method, 'GET');
// t.is(request.url, `${client.apiBaseUrl}/v3/menus`);
// t.is(request.requestHeaders.Accept, 'application/json');
// t.is(request.requestHeaders['Content-Type'], 'application/json;charset=utf-8');
// t.is(request.requestHeaders.Authorization, 'Token token=valid_token');
// });
/**
* @test {PlatformMenuService.get}
*/
test('[unit] PlatformMenuService.get should receive a valid response for a get request without an id', async (t) => {
const response = await platformMenuService.get();
t.truthy(response);
t.is(response[0].id, 35);
t.is(response[0].type, 'menus');
t.is(response[0].children[0].id, 36);
t.is(response[0].authorizable, null);
// const menus = Object.values(response);
// const parents = menus.filter(menu => (!menu.parent));
// console.log('menus', parents.length);
// console.log('parents', parents.length);
// parents.forEach((menu) => {
// if (menu.parent) {
// console.log('parent', menu.parent.id);
// }
// if (menu.children) {
// console.log('children', menu.children);
// // menu.children.forEach((child) => {
// // if (child.id) {
// // console.log('child', child.id);
// // } else {
// // console.log('child', child.toJSON());
// // }
// // });
// }
// });
// console.log(parents[0]);
// console.log(Object.keys(response));
// t.is(Object.keys(response).length, 4);
});
/**
* @test {PlatformMenuService.get}
*/
test('[unit] PlatformMenuService.get should receive a valid response for a get request with an id', async (t) => {
const response = await platformMenuService.get({ id: 4 });
t.truthy(response);
t.is(response.id, 319);
t.is(response.type, 'menus');
t.is(response.title, 'vitae');
t.is(response.position, 1);
t.is(response.enabled, true);
t.is(response.url, '#');
t.is(response.accessClass, null);
});
// PlatformMenuService.insert method
/**
* @test {PlatformMenuService.insert}
*/
test.serial('[unit] PlatformMenuService.insert should throw an error when there is no authToken', async (t) => {
client.authToken = undefined;
const expectedError = 'PlatformMenuService.insert error: requires authToken';
await t.throwsAsync(platformMenuService.insert({}), expectedError);
});
/**
* @test {PlatformMenuService.insert}
*/
test('[unit] PlatformMenuService.insert should successfully insert a platformMenu with a platformMenu object', async (t) => {
const requestJsonApi = {
data: {
type: 'menus',
attributes: {
title: 'vitae',
icon: 'icon-star'
}
}
};
client.mobileApplicationKey = '0355b2fb1c8fa7210bec203abb32b916';
const platformMenu = new PlatformMenu(requestJsonApi);
const response = await platformMenuService.insert(platformMenu);
// const request = t.context.server.requests[0];
// t.is(request.method, 'POST');
// t.is(request.url, `${client.apiBaseUrl}/v3/menus`);
// t.is(request.requestHeaders.Accept, 'application/json');
// t.is(request.requestBody, JSON.stringify(requestJsonApi));
// t.is(request.requestHeaders['Content-Type'], 'application/json;charset=utf-8');
// t.is(request.requestHeaders.Authorization, 'Token token=valid_token');
t.is(response.id, 322);
t.is(response.type, 'menus');
t.is(response.title, 'vitae');
t.is(response.icon, 'icon-star');
});
// PlatformMenuService.update method
/**
* @test {PlatformMenuService.update}
*/
test('[unit] PlatformMenuService.update should throw errors for invalid parameters', async (t) => {
const undefinedError = 'PlatformMenuService.update error: platformMenu is not defined';
await t.throwsAsync(platformMenuService.update(), undefinedError);
});
/**
* @test {PlatformMenuService.update}
*/
test('[unit] PlatformMenuService.update should successfully update a platformMenu with a platformMenu object', async (t) => {
const { platformMenu } = t.context; // platformMenuJsonApi
const response = await platformMenuService.update(platformMenu);
// const request = t.context.server.requests[0];
// t.is(request.method, 'PATCH');
// t.is(request.url, `${client.apiBaseUrl}/v3/menus/${platformMenu.id}`);
// t.is(request.requestHeaders.Accept, 'application/json');
// t.is(request.requestBody, JSON.stringify(platformMenuJsonApi));
// t.is(request.requestHeaders['Content-Type'], 'application/json;charset=utf-8');
// t.is(request.requestHeaders.Authorization, 'Token token=valid_token');
t.is(response.id, 330);
t.is(response.type, 'menus');
});