Skip to content

Commit

Permalink
Merge pull request #970 from aneoconsulting/chore/sonarcloud/update-d…
Browse files Browse the repository at this point in the history
…efault-configuration-tests

chore: update default configuration tests
  • Loading branch information
ngruelaneo authored Mar 20, 2024
2 parents 01e50d7 + b601e9d commit cc23214
Showing 1 changed file with 33 additions and 61 deletions.
94 changes: 33 additions & 61 deletions src/app/services/default-config-service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,93 +13,65 @@ describe('DefaultConfigService', () => {
expect(service.defaultTheme).toBe('indigo-pink');
});

it('should call defaultExternalServices getter', () => {
const spyGetDefaultExternalServices = jest.spyOn(service, 'defaultExternalServices', 'get');
service.defaultExternalServices;
expect(spyGetDefaultExternalServices).toHaveBeenCalled();
it('should have a defined defaultExternalServices configuration', () => {
expect(service.defaultExternalServices).toBeDefined();
});

it('should call defaultTasks getter', () => {
const spyGetDefaultTasks = jest.spyOn(service, 'defaultTasks', 'get');
service.defaultTasks;
expect(spyGetDefaultTasks).toHaveBeenCalled();
it('should have a defined defaultTasks configuration', () => {
expect(service.defaultTasks).toBeDefined();
});

it('should call defaultTasksByStatus getter', () => {
const spyGetDefaultTasksByStatus = jest.spyOn(service, 'defaultTasksByStatus', 'get');
service.defaultTasksByStatus;
expect(spyGetDefaultTasksByStatus).toHaveBeenCalled();
it('should have a defined defaultTasksByStatus configuration', () => {
expect(service.defaultTasksByStatus).toBeDefined();
});

it('should call defaultPartititons getter', () => {
const spyGetDefaultPartitions = jest.spyOn(service, 'defaultPartitions', 'get');
service.defaultPartitions;
expect(spyGetDefaultPartitions).toHaveBeenCalled();
it('should have a defined defaultPartititons configuration', () => {
expect(service.defaultPartitions).toBeDefined();
});

it('should call defaultDashboardSplitLines getter', ()=> {
const spyGetDefaultDashboardSplitLines = jest.spyOn(service, 'defaultDashboardSplitLines', 'get');
service.defaultDashboardSplitLines;
expect(spyGetDefaultDashboardSplitLines).toHaveBeenCalled();
it('should have a defined defaultDashboardSplitLines configuration', ()=> {
expect(service.defaultDashboardSplitLines).toBeDefined();
});

it('should call defaultDashboardLines getter', ()=> {
const spyGetDefaultDashboardLines = jest.spyOn(service, 'defaultDashboardLines', 'get');
service.defaultDashboardLines;
expect(spyGetDefaultDashboardLines).toHaveBeenCalled();
});
it('should have a defined defaultSessions configuration', () => {
expect(service.defaultSessions).toBeDefined();
});

it('should call defaultSessions getter', () => {
const spyGetDefaultSessions = jest.spyOn(service, 'defaultSessions', 'get');
service.defaultSessions;
expect(spyGetDefaultSessions).toHaveBeenCalled();
it('should have a defined defaultResults configuration', () => {
expect(service.defaultResults).toBeDefined();
});

it('should call defaultResults getter', () => {
const spyGetDefaultResults = jest.spyOn(service, 'defaultResults', 'get');
service.defaultResults;
expect(spyGetDefaultResults).toHaveBeenCalled();
it('should have a defined defaultApplications configuration', () => {
expect(service.defaultApplications).toBeDefined();
});

it('should call defaultApplications getter', () => {
const spyGetDefaultApplications = jest.spyOn(service, 'defaultApplications', 'get');
service.defaultApplications;
expect(spyGetDefaultApplications).toHaveBeenCalled();
it('should have a defined defaultSidebar configuration', () => {
expect(service.defaultSidebar).toBeDefined();
});

it('should call defaultSidebar getter', () => {
const spyGetDefaultSidebar = jest.spyOn(service, 'defaultSidebar', 'get');
service.defaultSidebar;
expect(spyGetDefaultSidebar).toHaveBeenCalled();
it('should have a defined defaultTasksViewInLogs configuration', () => {
expect(service.defaultTasksViewInLogs).toBeDefined();
});

it('should call defaultTasksViewInLogs getter', () => {
const spyGetDefaultTasksViewInLogs = jest.spyOn(service, 'defaultTasksViewInLogs', 'get');
service.defaultTasksViewInLogs;
expect(spyGetDefaultTasksViewInLogs).toHaveBeenCalled();
it('should have a defined exportedDefaultConfig configuration', () => {
expect(service.exportedDefaultConfig).toBeDefined();
});

it('should call exportedDefaultConfig getter', () => {
const spyGetExportedDefaultConfig = jest.spyOn(service, 'exportedDefaultConfig', 'get');
service.exportedDefaultConfig;
expect(spyGetExportedDefaultConfig).toHaveBeenCalled();
it('should have a defined defaultLanguage configuration', () => {
expect(service.defaultLanguage).toBeDefined();
});

it('should call defaultLanguage getter', () => {
const spyGetDefaultLanguage = jest.spyOn(service, 'defaultLanguage', 'get');
service.defaultLanguage;
expect(spyGetDefaultLanguage).toHaveBeenCalled();
it('should have a defined availableLanguages configuration', () => {
expect(service.availableLanguages).toBeDefined();
});

it('should call availableLanguages getter', () => {
const spyGetAvailableLanguage = jest.spyOn(service, 'availableLanguages', 'get');
service.availableLanguages;
expect(spyGetAvailableLanguage).toHaveBeenCalled();
it('should have a defined healthcheck configuration', () => {
expect(service.healthCheck).toBeDefined();
});

describe(' default dashboard configuration', () => {
it('the dashboard lines configuration should display at least 1 line', () => {
expect(service.defaultDashboardLines).toHaveLength(1);
expect(service.defaultDashboardLines).toBeDefined();
});

it('the line by default should contain 3 task statuses', () => {
Expand All @@ -110,9 +82,9 @@ describe('DefaultConfigService', () => {
it('the line by default should have finished, running, error, task statuses by default ', () => {
const defaultDashboardLines = service.defaultDashboardLines;
const taskStatuses = defaultDashboardLines.map( line => line.taskStatusesGroups) as unknown as TasksStatusesGroup[][];
expect(taskStatuses[0].map(taskStatus => taskStatus.name === 'Finished')).toBeTruthy();
expect(taskStatuses[0].map(taskStatus => taskStatus.name === 'Running')).toBeTruthy();
expect(taskStatuses[0].map(taskStatus => taskStatus.name === 'Errors')).toBeTruthy();
expect(taskStatuses[0].map(taskStatus => taskStatus.name === 'Finished')).toBeTruthy();
expect(taskStatuses[0].map(taskStatus => taskStatus.name === 'Running')).toBeTruthy();
expect(taskStatuses[0].map(taskStatus => taskStatus.name === 'Errors')).toBeTruthy();
});

it('default DashboardSplitLines should return 1 line', ()=> {
Expand Down

1 comment on commit cc23214

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines Statements Branches Functions
Coverage: 89%
89.12% (2770/3108) 71.58% (509/711) 81.13% (645/795)

JUnit

Tests Skipped Failures Errors Time
770 0 💤 0 ❌ 0 🔥 58.134s ⏱️
Files coverage (89%)
File% Stmts% Branch% Funcs% LinesUncovered Line #s
All files89.1271.5881.1389.72 
applications100100100100 
   index.component.ts100100100100 
applications/components85.1471.4272.7288.42 
   table.component.ts85.1471.4272.7288.42126–148, 242, 256
applications/services87.577.7776.1988.23 
   applications-filters.service.ts79.1610062.581.8175–81
   applications-grpc.service.ts9271.4210091.6676–82
   applications-index.service.ts91.366.668090.970–74
components96.0592.4291.5996.35 
   actions-toolbar-group.component.ts100100100100 
   actions-toolbar.component.ts100100100100 
   auto-refresh-button.component.html100100100100 
   auto-refresh-button.component.ts1006010010036, 59
   auto-refresh-dialog.component.html100100100100 
   auto-refresh-dialog.component.ts100100100100 
   columns-button.component.ts100100100100 
   columns-modify-dialog.component.html100100100100 
   columns-modify-dialog.component.ts94.599089.4710050
   count-tasks-by-status.component.ts1005010010056
   page-header.component.html100100100100 
   page-header.component.ts8010008033
   page-section-header.component.ts8010008031
   page-section.component.ts100100100100 
   refresh-button.component.ts100100100100 
   share-url.component.ts92.851007592.337
   show-action-area.component.html100100100100 
   show-action-area.component.ts100100100100 
   show-actions.component.html100100100100 
   show-actions.component.ts100100100100 
   show-card-content.component.html100100100100 
   show-card-content.component.ts100100100100 
   show-card.component.ts7510007537–38
   show-page.component.ts100100100100 
   spinner.component.ts100100100100 
   table-actions-toolbar.component.html100100100100 
   table-actions-toolbar.component.ts100100100100 
   table-container.component.ts100100100100 
   view-tasks-by-status-dialog.component.html100100100100 
   view-tasks-by-status-dialog.component.ts100100100100 
   view-tasks-by-status.component.ts73.5206072.7259, 88–106
components/filters94.2187.493.5894.24 
   filters-chips.component.html100100100100 
   filters-chips.component.ts100100100100 
   filters-dialog-and.component.html100100100100 
   filters-dialog-and.component.ts100100100100 
   filters-dialog-filter-field.component.html100100100100 
   filters-dialog-filter-field.component.ts92.9487.597.2992.36104, 114, 124, 136–139, 147, 192–194, 201, 334
   filters-dialog-input.component.html100100100100 
   filters-dialog-input.component.ts8278.7871.4283.3357, 85–86, 142–151
   filters-dialog-or.component.html100100100100 
   filters-dialog-or.component.ts100100100100 
   filters-dialog.component.html100100100100 
   filters-dialog.component.ts100100100100 
   filters-toolbar.component.html100100100100 
   filters-toolbar.component.ts100100100100 
components/navigation99.1197.0595.8399.07 
   add-external-service-dialog.component.html100100100100 
   add-external-service-dialog.component.ts100100100100 
   change-language-button.component.html100100100100 
   change-language-button.component.ts97.291009096.9657
   edit-external-service-dialog.component.html100100100100 
   edit-external-service-dialog.component.ts100100100100 
   form-external-service.component.html100100100100 
   form-external-service.component.ts100100100100 
   manage-external-services-dialog.component.html100100100100 
   manage-external-services-dialog.component.ts100100100100 
   navigation.component.html100100100100 
   navigation.component.ts98.1893.3388.8898.14113
   theme-selector.component.html100100100100 
   theme-selector.component.ts100100100100 
components/table80.268.7565.3880 
   table-actions.component.html100100100100 
   table-actions.component.ts87.5100087.529
   table-cell.component.html100100100100 
   table-cell.component.ts90.7484.6189.4790.7491, 105, 115–119
   table-empty-data.component.ts100100100100 
   table-inspect-object-dialog.component.html100100100100 
   table-inspect-object-dialog.component.ts41.66100041.6626–40
   table-inspect-object.component.html100100100100 
   table-inspect-object.component.ts60006031–50
dashboard89.0135.7193.3388.88 
   index.component.html100100100100 
   index.component.ts88.8835.7193.3388.76166–180, 193, 231
dashboard/components99.210098.5799.19 
   add-line-dialog.component.ts100100100100 
   add-statuses-group-dialog.component.ts100100100100 
   edit-name-line-dialog.component.ts100100100100 
   edit-status-group-dialog.component.ts100100100100 
   form-name-line.component.html100100100100 
   form-name-line.component.ts95.6510083.3395.6586
   form-statuses-group.component.html100100100100 
   form-statuses-group.component.ts100100100100 
   manage-groups-dialog.component.html100100100100 
   manage-groups-dialog.component.ts100100100100 
   reorganize-lines-dialog.component.html100100100100 
   reorganize-lines-dialog.component.ts100100100100 
   split-lines-dialog.component.ts100100100100 
   statuses-group-card.component.html100100100100 
   statuses-group-card.component.ts97.9110010097.72138
dashboard/components/lines98.0188.8895.7497.96 
   applications-line.component.html100100100100 
   applications-line.component.ts97.4390.996.2997.36138–140
   task-by-status-line.component.html100100100100 
   task-by-status-line.component.ts98.7985.719598.76210
dashboard/services100100100100 
   dashboard-index.service.ts100100100100 
   dashboard-storage.service.ts100100100100 
directives50100050 
   no-wrap.directive.ts501000505–6
healthcheck100100100100 
   index.component.html100100100100 
   index.component.ts100100100100 
healthcheck/services100100100100 
   healthcheck-grpc.service.ts100100100100 
   healthcheck-index.service.ts100100100100 
partitions/components85.2256.257586.9 
   table.component.html100100100100 
   table.component.ts85.0556.257586.7478–100, 173, 205
partitions/services21.730018.18 
   partitions-index.service.ts21.730018.1811–120
pipes250018.18 
   duration.pipe.ts16.660011.767–27
   empty-cell.pipe.ts5000406–10
results/components81.66058.3384.21 
   table.component.html100100100100 
   table.component.ts81.35058.3383.9274–90, 105
results/services34.4808.3329.62 
   results-index.service.ts21.730018.1810–117
   results-statuses.service.ts83.33100508016
services93.4877.5386.7993.53 
   auto-refresh.service.ts100100100100 
   default-config.service.ts10050100100193
   environment.service.ts80100507519
   filters.service.ts50037.55277–93
   grpc-build-request.service.ts64.288.3316.6664.2826, 39, 49, 59, 69
   icons.service.ts100100100100 
   navigation.service.ts10080100100116
   notification.service.ts100100100100 
   query-params.service.ts100100100100 
   share-url.service.ts100100100100 
   storage.service.ts98.0310010097.9595
   table-storage.service.ts500042.8511–31
   table-url.service.ts100100100100 
   table.service.ts100100100100 
   tasks-by-status.service.ts100100100100 
   user-grpc.service.ts100100100100 
   user.service.ts100100100100 
   utils.service.ts97.5694.1110097.43119
   versions-grpc.service.ts100100100100 
   versions.service.ts1007010010014, 25, 32
sessions/components80.7964.5163.1585.61 
   table.component.html100100100100 
   table.component.ts80.6664.5163.1585.592, 153–159, 193–195, 215–221, 292–302, 324
sessions/services46.3721.4225.9245.31 
   sessions-filters.service.ts66.66506070168–186
   sessions-index.service.ts17.850014.8111–218
   sessions-statuses.service.ts62.51002557.1418–26
tasks/components78.943.7559.3783.33 
   table.component.html100100100100 
   table.component.ts78.7443.7559.3783.19104, 118, 167–179, 208–230, 243
tasks/services60.95266060.6 
   tasks-filters.service.ts69.6983.336073.33207–220
   tasks-grpc.service.ts21.210018.7513–155
   tasks-index.service.ts87.09808086.66229, 295–300
   tasks-statuses.service.ts87.507585.7141
tokens100100100100 
   filters.token.ts100100100100 
types100100100100 
   filter-definition.ts100100100100 

Please sign in to comment.