From a1b945ae872b3dd8a86a614a541e538166b74233 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simen=20Heggest=C3=B8yl?= Date: Mon, 6 Nov 2023 09:17:17 +0100 Subject: [PATCH] Lint the test directory --- package.json | 4 +- .../e2e/specs/01 Login/01 login_error_spec.js | 5 +- .../01 Login/02 login_admin_user_spec.js | 5 +- .../01 Request_access_spec.js | 15 +- .../10 Organization/organization_spec.js | 21 ++- .../specs/20 Department/department_spec.js | 34 +++- .../specs/30 Product/02 objectives.spec.js | 8 +- .../40 Whitelist user/01 whitelist.spec.js | 5 +- .../03 updateDataAsTestUser.spec.js | 9 +- tests/e2e/support/createObjective.js | 6 +- tests/e2e/support/createOrg.js | 4 +- tests/e2e/support/createProduct.js | 4 +- tests/e2e/support/createTestDepartment.js | 8 +- tests/e2e/support/deleteProduct.js | 10 +- .../unit/getKeyResultProgressDetails.test.js | 149 +++++++++++++----- 15 files changed, 213 insertions(+), 74 deletions(-) diff --git a/package.json b/package.json index d3935db5e..0548acdab 100644 --- a/package.json +++ b/package.json @@ -14,8 +14,8 @@ "deploy": ". ./.env.production && sed -i -e \"s||$VITE_API_GATEWAY_URL|g\" public/openapi.yaml && npm run build && sed -i -e \"s|$VITE_API_GATEWAY_URL||g\" public/openapi.yaml && firebase deploy --project=production", "deploy:test": "npm run build:test && firebase deploy --project=development", "deploy:feature_branch": "npm run build && firebase hosting:channel:deploy --project=production $npm_config_name", - "lint": "eslint ./src ./functions ./extras --ext .js,.vue,.gs", - "lint:fix": "eslint ./src ./functions ./extras --ext .js,.vue,.gs --fix", + "lint": "eslint ./src ./functions ./extras ./tests --ext .js,.vue,.gs", + "lint:fix": "eslint ./src ./functions ./extras ./tests --ext .js,.vue,.gs --fix", "lint:style": "stylelint 'src/**/*.scss' 'src/**/*.vue'", "lint:style:fix": "stylelint 'src/**/*.scss' 'src/**/*.vue' --fix", "export_mock_data": "firebase emulators:export ./mock_data" diff --git a/tests/e2e/specs/01 Login/01 login_error_spec.js b/tests/e2e/specs/01 Login/01 login_error_spec.js index 3343736be..de23a2f96 100644 --- a/tests/e2e/specs/01 Login/01 login_error_spec.js +++ b/tests/e2e/specs/01 Login/01 login_error_spec.js @@ -5,7 +5,10 @@ describe('Login error', () => { cy.visit('/').wait(500); cy.get('body').then(($body) => { - if ($body.text().includes('Test Admin') || $body.text().includes(Cypress.env('VITE_TESTUSER_USER'))) { + if ( + $body.text().includes('Test Admin') || + $body.text().includes(Cypress.env('VITE_TESTUSER_USER')) + ) { cy.signOut(); } }); diff --git a/tests/e2e/specs/01 Login/02 login_admin_user_spec.js b/tests/e2e/specs/01 Login/02 login_admin_user_spec.js index 920ad570f..022191d4b 100644 --- a/tests/e2e/specs/01 Login/02 login_admin_user_spec.js +++ b/tests/e2e/specs/01 Login/02 login_admin_user_spec.js @@ -3,7 +3,10 @@ describe('Test Admin Login', () => { cy.visit('/').wait(2000); cy.get('body').then(($body) => { - if ($body.text().includes('Test Admin') || $body.text().includes(Cypress.env('VITE_TESTUSER_USER'))) { + if ( + $body.text().includes('Test Admin') || + $body.text().includes(Cypress.env('VITE_TESTUSER_USER')) + ) { cy.signOut(); } }); diff --git a/tests/e2e/specs/03 Request access/01 Request_access_spec.js b/tests/e2e/specs/03 Request access/01 Request_access_spec.js index 8b1fba98c..c729d4acf 100644 --- a/tests/e2e/specs/03 Request access/01 Request_access_spec.js +++ b/tests/e2e/specs/03 Request access/01 Request_access_spec.js @@ -5,7 +5,10 @@ describe('Request access', () => { cy.visit('/').wait(2000); cy.get('body').then(($body) => { - if ($body.text().includes('Test Admin') || $body.text().includes(Cypress.env('VITE_TESTUSER_USER'))) { + if ( + $body.text().includes('Test Admin') || + $body.text().includes(Cypress.env('VITE_TESTUSER_USER')) + ) { cy.signOut(); } }); @@ -48,7 +51,10 @@ describe('Request access', () => { cy.get('[data-cy="request-accept"]').click(); }); - cy.get('.toasted').should('contain', i18n.t('toaster.request.accepted', { user: 'acceptme@internet.com' })); + cy.get('.toasted').should( + 'contain', + i18n.t('toaster.request.accepted', { user: 'acceptme@internet.com' }) + ); cy.get('.access-requests__item') .eq(0) @@ -57,6 +63,9 @@ describe('Request access', () => { cy.get('[data-cy="request-reject"]').click(); }); - cy.get('.toasted').should('contain', i18n.t('toaster.request.rejected', { user: 'rejectme@internet.com' })); + cy.get('.toasted').should( + 'contain', + i18n.t('toaster.request.rejected', { user: 'rejectme@internet.com' }) + ); }); }); diff --git a/tests/e2e/specs/10 Organization/organization_spec.js b/tests/e2e/specs/10 Organization/organization_spec.js index 5ab59cab2..ed8d18913 100644 --- a/tests/e2e/specs/10 Organization/organization_spec.js +++ b/tests/e2e/specs/10 Organization/organization_spec.js @@ -16,7 +16,10 @@ describe('Create department', () => { cy.get('.title-1').should('contain', testOrganization.name); cy.get('.team__list').should('be.empty'); - cy.get('[data-cy="mission_statement"]').should('contain', testOrganization.mission_statement); + cy.get('[data-cy="mission_statement"]').should( + 'contain', + testOrganization.mission_statement + ); cy.get('[data-cy="objectives_list"] .title').should('contain', '(0)'); }); }); @@ -45,7 +48,9 @@ describe('Create data for organization', () => { cy.get('[data-cy="objective_name_field"]').clear().type(testObjective.name); - cy.get('[data-cy="objective_description_field"]').clear().type(testObjective.description); + cy.get('[data-cy="objective_description_field"]') + .clear() + .type(testObjective.description); cy.get('[data-cy="save_objective_button"]').click(); }); @@ -55,11 +60,17 @@ describe('Create data for organization', () => { cy.get('[data-cy="keyResult_name_field"]').clear().type(testKeyResult.name); - cy.get('[data-cy="keyResult_longdescription_field"]').clear().type(testKeyResult.longDescription); + cy.get('[data-cy="keyResult_longdescription_field"]') + .clear() + .type(testKeyResult.longDescription); - cy.get('[data-cy="keyResult_startvalue_field"]').clear().type(testKeyResult.startValue); + cy.get('[data-cy="keyResult_startvalue_field"]') + .clear() + .type(testKeyResult.startValue); - cy.get('[data-cy="keyResult_targetvalue_field"]').clear().type(testKeyResult.targetValue); + cy.get('[data-cy="keyResult_targetvalue_field"]') + .clear() + .type(testKeyResult.targetValue); cy.get('[data-cy="keyResult_unit_field"]').clear().type(testKeyResult.unit); diff --git a/tests/e2e/specs/20 Department/department_spec.js b/tests/e2e/specs/20 Department/department_spec.js index 115696b0c..7366539fc 100644 --- a/tests/e2e/specs/20 Department/department_spec.js +++ b/tests/e2e/specs/20 Department/department_spec.js @@ -16,7 +16,10 @@ describe('Create department', () => { cy.get('.title-1').should('contain', testDepartment.name); cy.get('.team__list').should('be.empty'); - cy.get('[data-cy="mission_statement"]').should('contain', testDepartment.mission_statement); + cy.get('[data-cy="mission_statement"]').should( + 'contain', + testDepartment.mission_statement + ); cy.get('[data-cy="objectives_list"] .title').should('contain', '(0)'); }); }); @@ -43,7 +46,9 @@ describe('Create data for department', () => { cy.get('[data-cy="objective_name_field"]').clear().type(testObjective.name); - cy.get('[data-cy="objective_description_field"]').clear().type(testObjective.description); + cy.get('[data-cy="objective_description_field"]') + .clear() + .type(testObjective.description); cy.get('[data-cy="save_objective_button"]').click(); }); @@ -53,11 +58,17 @@ describe('Create data for department', () => { cy.get('[data-cy="keyResult_name_field"]').clear().type(testKeyResult.name); - cy.get('[data-cy="keyResult_longdescription_field"]').clear().type(testKeyResult.longDescription); + cy.get('[data-cy="keyResult_longdescription_field"]') + .clear() + .type(testKeyResult.longDescription); - cy.get('[data-cy="keyResult_startvalue_field"]').clear().type(testKeyResult.startValue); + cy.get('[data-cy="keyResult_startvalue_field"]') + .clear() + .type(testKeyResult.startValue); - cy.get('[data-cy="keyResult_targetvalue_field"]').clear().type(testKeyResult.targetValue); + cy.get('[data-cy="keyResult_targetvalue_field"]') + .clear() + .type(testKeyResult.targetValue); cy.get('[data-cy="keyResult_unit_field"]').clear().type(testKeyResult.unit); @@ -119,7 +130,9 @@ describe('Create progress for key result', () => { cy.get('svg text.percent').should('contain', '50%'); - cy.get('[data-cy="objectives_list"]').should('contain', '(50%)').should('contain', testObjective.description); + cy.get('[data-cy="objectives_list"]') + .should('contain', '(50%)') + .should('contain', testObjective.description); cy.get('.progress__current-value').should('contain', testKeyResult.progressValue); }); @@ -127,11 +140,16 @@ describe('Create progress for key result', () => { it('Updates progress from product page (inline)', () => { cy.get('button.keyResult__toggle').click(); - cy.get('.keyResult__edit input').clear().type(`${testKeyResult.targetValue} {enter}`).wait(2500); + cy.get('.keyResult__edit input') + .clear() + .type(`${testKeyResult.targetValue} {enter}`) + .wait(2500); cy.get('svg text.percent').should('contain', '100%'); - cy.get('[data-cy="objectives_list"]').should('contain', '(100%)').should('contain', testObjective.description); + cy.get('[data-cy="objectives_list"]') + .should('contain', '(100%)') + .should('contain', testObjective.description); cy.get('.progress__bar').should('have.class', 'completed'); }); diff --git a/tests/e2e/specs/30 Product/02 objectives.spec.js b/tests/e2e/specs/30 Product/02 objectives.spec.js index 41e128cb9..c706921c0 100644 --- a/tests/e2e/specs/30 Product/02 objectives.spec.js +++ b/tests/e2e/specs/30 Product/02 objectives.spec.js @@ -36,7 +36,9 @@ describe('Create objectives', () => { if (!$body.text().includes(testPeriod.name)) { cy.log('Period exists'); } else { - cy.visit(`/product/${testProducts[0].slug}/edit/objectives-key-results`).wait(1000); + cy.visit(`/product/${testProducts[0].slug}/edit/objectives-key-results`).wait( + 1000 + ); cy.createPeriod(); } }); @@ -48,7 +50,9 @@ describe('Create objectives', () => { if (!$body.text().includes(testPeriod.name)) { cy.log('Period exists'); } else { - cy.visit(`/product/${testProducts[1].slug}/edit/objectives-key-results`).wait(1000); + cy.visit(`/product/${testProducts[1].slug}/edit/objectives-key-results`).wait( + 1000 + ); cy.createPeriod(); } }); diff --git a/tests/e2e/specs/40 Whitelist user/01 whitelist.spec.js b/tests/e2e/specs/40 Whitelist user/01 whitelist.spec.js index fdff537ab..d2a883e40 100644 --- a/tests/e2e/specs/40 Whitelist user/01 whitelist.spec.js +++ b/tests/e2e/specs/40 Whitelist user/01 whitelist.spec.js @@ -29,7 +29,10 @@ describe('Whitelist user', () => { }); it('Finds the test user with search', () => { - cy.get('[data-cy="user_search_field"]').clear().type(Cypress.env('VITE_TESTUSER_USER')).wait(100); + cy.get('[data-cy="user_search_field"]') + .clear() + .type(Cypress.env('VITE_TESTUSER_USER')) + .wait(100); cy.get('.whitelist__body').should('contain', Cypress.env('VITE_TESTUSER_USER')); }); diff --git a/tests/e2e/specs/40 Whitelist user/03 updateDataAsTestUser.spec.js b/tests/e2e/specs/40 Whitelist user/03 updateDataAsTestUser.spec.js index 9dfc92bf8..ad07801d9 100644 --- a/tests/e2e/specs/40 Whitelist user/03 updateDataAsTestUser.spec.js +++ b/tests/e2e/specs/40 Whitelist user/03 updateDataAsTestUser.spec.js @@ -12,9 +12,7 @@ describe('Verifies restrictions for test user', () => { }); it('Logs in as test user', () => { - cy.get('input[type="password"]').type( - Cypress.env('VITE_TESTUSER_PASSWORD') - ); + cy.get('input[type="password"]').type(Cypress.env('VITE_TESTUSER_PASSWORD')); cy.get('form').submit(); cy.wait(1000); @@ -60,10 +58,7 @@ describe('Verifies restrictions for test user', () => { it('Allows test user to edit Product One', () => { cy.get('[data-cy="edit_object_link"]').click().wait(500); - cy.get('[data-cy="product_name_field"]').should( - 'have.value', - testProducts[0].name - ); + cy.get('[data-cy="product_name_field"]').should('have.value', testProducts[0].name); cy.get('[data-cy="product_mission_statement_field"]') .clear() diff --git a/tests/e2e/support/createObjective.js b/tests/e2e/support/createObjective.js index 4e940482f..d89ffcee4 100644 --- a/tests/e2e/support/createObjective.js +++ b/tests/e2e/support/createObjective.js @@ -6,7 +6,11 @@ import { testObjective, testPeriod } from '../config'; Cypress.Commands.add('createObjective', () => { cy.get('[data-cy="add_objective"]').click().wait(500); - cy.get('[data-cy="period_selector"]').click().type(testPeriod.name).get('.vs__dropdown-menu > li').click(); + cy.get('[data-cy="period_selector"]') + .click() + .type(testPeriod.name) + .get('.vs__dropdown-menu > li') + .click(); cy.get('[data-cy="objective_title_field"]').clear().type(testObjective.name); diff --git a/tests/e2e/support/createOrg.js b/tests/e2e/support/createOrg.js index ee5c2d7da..aed4b2474 100644 --- a/tests/e2e/support/createOrg.js +++ b/tests/e2e/support/createOrg.js @@ -9,7 +9,9 @@ Cypress.Commands.add('createTestOrg', () => { cy.get('[data-cy="org-name"]').clear().type(testOrganization.name); - cy.get('[data-cy="org-missionStatement"]').clear().type(testOrganization.mission_statement); + cy.get('[data-cy="org-missionStatement"]') + .clear() + .type(testOrganization.mission_statement); cy.get('[data-cy="btn-createOrg"]').click(); diff --git a/tests/e2e/support/createProduct.js b/tests/e2e/support/createProduct.js index 3a853511e..77688e973 100644 --- a/tests/e2e/support/createProduct.js +++ b/tests/e2e/support/createProduct.js @@ -13,7 +13,9 @@ Cypress.Commands.add('createProduct', (productIndex) => { cy.get('[data-cy="product_name_field"]').clear().type(testProducts[productIndex].name); - cy.get('[data-cy="product_mission_statement_field"]').clear().type(testProducts[productIndex].mission_statement); + cy.get('[data-cy="product_mission_statement_field"]') + .clear() + .type(testProducts[productIndex].mission_statement); cy.get('[data-cy="save_product_button"]').click(); }); diff --git a/tests/e2e/support/createTestDepartment.js b/tests/e2e/support/createTestDepartment.js index 686ff8009..ec85a20a0 100644 --- a/tests/e2e/support/createTestDepartment.js +++ b/tests/e2e/support/createTestDepartment.js @@ -9,9 +9,13 @@ Cypress.Commands.add('createTestDepartment', () => { cy.get('[data-cy="dep-name"]').clear().type(testDepartment.name); - cy.get('[data-cy="dep-missionStatement"]').clear().type(testDepartment.mission_statement); + cy.get('[data-cy="dep-missionStatement"]') + .clear() + .type(testDepartment.mission_statement); - cy.get('[data-cy="dep-parentOrg"]').select(testDepartment.parentOrg).should('have.value', testDepartment.parentOrg); + cy.get('[data-cy="dep-parentOrg"]') + .select(testDepartment.parentOrg) + .should('have.value', testDepartment.parentOrg); cy.get('[data-cy="btn-createDep"]').click(); }); diff --git a/tests/e2e/support/deleteProduct.js b/tests/e2e/support/deleteProduct.js index feb2760bc..c652635df 100644 --- a/tests/e2e/support/deleteProduct.js +++ b/tests/e2e/support/deleteProduct.js @@ -9,7 +9,10 @@ Cypress.Commands.add('deleteProduct', (productIndex) => { cy.get('.miller__col__item').contains(testDepartment.name).click().wait(500); - cy.get('.miller__col__item').contains(testProducts[productIndex].name).click().wait(500); + cy.get('.miller__col__item') + .contains(testProducts[productIndex].name) + .click() + .wait(500); cy.get('[data-cy="delete_product_button"]').click().wait(100); @@ -17,7 +20,10 @@ Cypress.Commands.add('deleteProduct', (productIndex) => { cy.get('.miller__col__item').contains(testDepartment.name).click().wait(750); - cy.get('.miller__col__item').contains(testProducts[productIndex].name).click().wait(750); + cy.get('.miller__col__item') + .contains(testProducts[productIndex].name) + .click() + .wait(750); cy.get('[data-cy="permanently-delete-object"]').click(); }); diff --git a/tests/unit/getKeyResultProgressDetails.test.js b/tests/unit/getKeyResultProgressDetails.test.js index 2c479d4ae..9854425a2 100644 --- a/tests/unit/getKeyResultProgressDetails.test.js +++ b/tests/unit/getKeyResultProgressDetails.test.js @@ -1,4 +1,7 @@ -import { getKeyResultProgression, getKeyResultProgressDetails } from '../../src/util/keyResultProgress'; +import { + getKeyResultProgression, + getKeyResultProgressDetails, +} from '../../src/util/keyResultProgress'; const generateKeyResult = (startValue, targetValue, currentValue) => ({ startValue, @@ -11,8 +14,12 @@ describe('Get key result progress', () => { describe('for results with target value greater than initial value', () => { test('{ startValue: 0, targetValue: 100, currentValue: 0 }', () => { const keyResult = generateKeyResult(0, 100, 0); - const { percentageCompleted, totalRemainingTasks, totalCompletedTasks, totalNumberOfTasks } = - getKeyResultProgressDetails(keyResult); + const { + percentageCompleted, + totalRemainingTasks, + totalCompletedTasks, + totalNumberOfTasks, + } = getKeyResultProgressDetails(keyResult); expect(percentageCompleted).toEqual(0); expect(totalRemainingTasks).toEqual(100); @@ -22,8 +29,12 @@ describe('Get key result progress', () => { test('{ startValue: 0, targetValue: 100, currentValue: 20 }', () => { const keyResult = generateKeyResult(0, 100, 20); - const { percentageCompleted, totalRemainingTasks, totalCompletedTasks, totalNumberOfTasks } = - getKeyResultProgressDetails(keyResult); + const { + percentageCompleted, + totalRemainingTasks, + totalCompletedTasks, + totalNumberOfTasks, + } = getKeyResultProgressDetails(keyResult); expect(percentageCompleted).toEqual(20); expect(totalRemainingTasks).toEqual(80); @@ -33,8 +44,12 @@ describe('Get key result progress', () => { test('{ startValue: 0, targetValue: 100, currentValue: 100 }', () => { const keyResult = generateKeyResult(0, 100, 100); - const { percentageCompleted, totalRemainingTasks, totalCompletedTasks, totalNumberOfTasks } = - getKeyResultProgressDetails(keyResult); + const { + percentageCompleted, + totalRemainingTasks, + totalCompletedTasks, + totalNumberOfTasks, + } = getKeyResultProgressDetails(keyResult); expect(percentageCompleted).toEqual(100); expect(totalRemainingTasks).toEqual(0); @@ -44,8 +59,12 @@ describe('Get key result progress', () => { test('{ startValue: 0, targetValue: 100, currentValue: 150 }', () => { const keyResult = generateKeyResult(0, 100, 150); - const { percentageCompleted, totalRemainingTasks, totalCompletedTasks, totalNumberOfTasks } = - getKeyResultProgressDetails(keyResult); + const { + percentageCompleted, + totalRemainingTasks, + totalCompletedTasks, + totalNumberOfTasks, + } = getKeyResultProgressDetails(keyResult); expect(percentageCompleted).toEqual(150); expect(totalRemainingTasks).toEqual(0); @@ -55,8 +74,12 @@ describe('Get key result progress', () => { test('{ startValue: 20, targetValue: 100, currentValue: 20 }', () => { const keyResult = generateKeyResult(20, 100, 20); - const { percentageCompleted, totalRemainingTasks, totalCompletedTasks, totalNumberOfTasks } = - getKeyResultProgressDetails(keyResult); + const { + percentageCompleted, + totalRemainingTasks, + totalCompletedTasks, + totalNumberOfTasks, + } = getKeyResultProgressDetails(keyResult); expect(percentageCompleted).toEqual(0); expect(totalRemainingTasks).toEqual(80); @@ -66,8 +89,12 @@ describe('Get key result progress', () => { test('{ startValue: 20, targetValue: 100, currentValue: 100 }', () => { const keyResult = generateKeyResult(20, 100, 100); - const { percentageCompleted, totalRemainingTasks, totalCompletedTasks, totalNumberOfTasks } = - getKeyResultProgressDetails(keyResult); + const { + percentageCompleted, + totalRemainingTasks, + totalCompletedTasks, + totalNumberOfTasks, + } = getKeyResultProgressDetails(keyResult); expect(percentageCompleted).toEqual(100); expect(totalRemainingTasks).toEqual(0); @@ -77,8 +104,12 @@ describe('Get key result progress', () => { test('{ startValue: 20, targetValue: 100, currentValue: 0 }', () => { const keyResult = generateKeyResult(20, 100, 0); - const { percentageCompleted, totalRemainingTasks, totalCompletedTasks, totalNumberOfTasks } = - getKeyResultProgressDetails(keyResult); + const { + percentageCompleted, + totalRemainingTasks, + totalCompletedTasks, + totalNumberOfTasks, + } = getKeyResultProgressDetails(keyResult); expect(percentageCompleted).toEqual(-25); expect(totalRemainingTasks).toEqual(100); @@ -88,8 +119,12 @@ describe('Get key result progress', () => { test('{ startValue: 20, targetValue: 100, currentValue: -20 }', () => { const keyResult = generateKeyResult(20, 100, -20); - const { percentageCompleted, totalRemainingTasks, totalCompletedTasks, totalNumberOfTasks } = - getKeyResultProgressDetails(keyResult); + const { + percentageCompleted, + totalRemainingTasks, + totalCompletedTasks, + totalNumberOfTasks, + } = getKeyResultProgressDetails(keyResult); expect(percentageCompleted).toEqual(-50); expect(totalRemainingTasks).toEqual(120); @@ -101,8 +136,12 @@ describe('Get key result progress', () => { describe('for results with target value greater than initial value', () => { test('{ startValue: 100, targetValue: 0, currentValue: 100 }', () => { const keyResult = generateKeyResult(100, 0, 100); - const { percentageCompleted, totalRemainingTasks, totalCompletedTasks, totalNumberOfTasks } = - getKeyResultProgressDetails(keyResult); + const { + percentageCompleted, + totalRemainingTasks, + totalCompletedTasks, + totalNumberOfTasks, + } = getKeyResultProgressDetails(keyResult); expect(percentageCompleted).toEqual(0); expect(totalRemainingTasks).toEqual(100); @@ -112,8 +151,12 @@ describe('Get key result progress', () => { test('{ startValue: 100, targetValue: 0, currentValue: 80 }', () => { const keyResult = generateKeyResult(100, 0, 80); - const { percentageCompleted, totalRemainingTasks, totalCompletedTasks, totalNumberOfTasks } = - getKeyResultProgressDetails(keyResult); + const { + percentageCompleted, + totalRemainingTasks, + totalCompletedTasks, + totalNumberOfTasks, + } = getKeyResultProgressDetails(keyResult); expect(percentageCompleted).toEqual(20); expect(totalRemainingTasks).toEqual(80); @@ -123,8 +166,12 @@ describe('Get key result progress', () => { test('{ startValue: 100, targetValue: 0, currentValue: 0 }', () => { const keyResult = generateKeyResult(100, 0, 0); - const { percentageCompleted, totalRemainingTasks, totalCompletedTasks, totalNumberOfTasks } = - getKeyResultProgressDetails(keyResult); + const { + percentageCompleted, + totalRemainingTasks, + totalCompletedTasks, + totalNumberOfTasks, + } = getKeyResultProgressDetails(keyResult); expect(percentageCompleted).toEqual(100); expect(totalRemainingTasks).toEqual(0); @@ -134,8 +181,12 @@ describe('Get key result progress', () => { test('{ startValue: 100, targetValue: 20, currentValue: 100 }', () => { const keyResult = generateKeyResult(100, 20, 100); - const { percentageCompleted, totalRemainingTasks, totalCompletedTasks, totalNumberOfTasks } = - getKeyResultProgressDetails(keyResult); + const { + percentageCompleted, + totalRemainingTasks, + totalCompletedTasks, + totalNumberOfTasks, + } = getKeyResultProgressDetails(keyResult); expect(percentageCompleted).toEqual(0); expect(totalRemainingTasks).toEqual(80); @@ -145,8 +196,12 @@ describe('Get key result progress', () => { test('{ startValue: 100, targetValue: 20, currentValue: 80 }', () => { const keyResult = generateKeyResult(100, 20, 80); - const { percentageCompleted, totalRemainingTasks, totalCompletedTasks, totalNumberOfTasks } = - getKeyResultProgressDetails(keyResult); + const { + percentageCompleted, + totalRemainingTasks, + totalCompletedTasks, + totalNumberOfTasks, + } = getKeyResultProgressDetails(keyResult); expect(percentageCompleted).toEqual(25); expect(totalRemainingTasks).toEqual(60); @@ -156,8 +211,12 @@ describe('Get key result progress', () => { test('{ startValue: 100, targetValue: 20, currentValue: 20 }', () => { const keyResult = generateKeyResult(100, 20, 20); - const { percentageCompleted, totalRemainingTasks, totalCompletedTasks, totalNumberOfTasks } = - getKeyResultProgressDetails(keyResult); + const { + percentageCompleted, + totalRemainingTasks, + totalCompletedTasks, + totalNumberOfTasks, + } = getKeyResultProgressDetails(keyResult); expect(percentageCompleted).toEqual(100); expect(totalRemainingTasks).toEqual(0); @@ -167,8 +226,12 @@ describe('Get key result progress', () => { test('{ startValue: 100, targetValue: 20, currentValue: 0 }', () => { const keyResult = generateKeyResult(100, 20, 0); - const { percentageCompleted, totalRemainingTasks, totalCompletedTasks, totalNumberOfTasks } = - getKeyResultProgressDetails(keyResult); + const { + percentageCompleted, + totalRemainingTasks, + totalCompletedTasks, + totalNumberOfTasks, + } = getKeyResultProgressDetails(keyResult); expect(percentageCompleted).toEqual(125); expect(totalRemainingTasks).toEqual(0); @@ -180,8 +243,12 @@ describe('Get key result progress', () => { describe('for results with start and target value equal to 0', () => { test('{ startValue: 0, targetValue: 0, currentValue: 0 }', () => { const keyResult = generateKeyResult(0, 0, 0); - const { percentageCompleted, totalRemainingTasks, totalCompletedTasks, totalNumberOfTasks } = - getKeyResultProgressDetails(keyResult); + const { + percentageCompleted, + totalRemainingTasks, + totalCompletedTasks, + totalNumberOfTasks, + } = getKeyResultProgressDetails(keyResult); expect(percentageCompleted).toEqual(0); expect(totalRemainingTasks).toEqual(0); expect(totalCompletedTasks).toEqual(0); @@ -192,8 +259,12 @@ describe('Get key result progress', () => { describe('for results without current value', () => { test('{ startValue: 0, targetValue: 100 }', () => { const keyResult = generateKeyResult(0, 100); - const { percentageCompleted, totalRemainingTasks, totalCompletedTasks, totalNumberOfTasks } = - getKeyResultProgressDetails(keyResult); + const { + percentageCompleted, + totalRemainingTasks, + totalCompletedTasks, + totalNumberOfTasks, + } = getKeyResultProgressDetails(keyResult); expect(percentageCompleted).toEqual(0); expect(totalRemainingTasks).toEqual(100); @@ -203,8 +274,12 @@ describe('Get key result progress', () => { test('{ startValue: 100, targetValue: 0 }', () => { const keyResult = generateKeyResult(100, 0); - const { percentageCompleted, totalRemainingTasks, totalCompletedTasks, totalNumberOfTasks } = - getKeyResultProgressDetails(keyResult); + const { + percentageCompleted, + totalRemainingTasks, + totalCompletedTasks, + totalNumberOfTasks, + } = getKeyResultProgressDetails(keyResult); expect(percentageCompleted).toEqual(0); expect(totalRemainingTasks).toEqual(100);