From 696d2ea9d2b3833d9a4dd230203ec5ac1718bec7 Mon Sep 17 00:00:00 2001 From: Travis Harris Date: Tue, 7 May 2024 00:59:35 -0700 Subject: [PATCH] test(designer): Add tests for display of scope ids (#4792) * test(designer): Add tests for display of scope ids * test(designer): Add tests for display of scope ids --- .github/workflows/coverage-report.yml | 4 +++- .../helpers/__test__/stringFunctions.spec.ts | 24 ++++++++++++++++--- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/.github/workflows/coverage-report.yml b/.github/workflows/coverage-report.yml index 991788f8399..8a6d3c29a05 100644 --- a/.github/workflows/coverage-report.yml +++ b/.github/workflows/coverage-report.yml @@ -14,7 +14,9 @@ jobs: steps: - name: 'Checkout Github Action' uses: actions/checkout@master - + with: + fetch-depth: 0 + - name: Cache turbo build setup uses: actions/cache@v4 with: diff --git a/libs/logic-apps-shared/src/utils/src/lib/helpers/__test__/stringFunctions.spec.ts b/libs/logic-apps-shared/src/utils/src/lib/helpers/__test__/stringFunctions.spec.ts index d2c9a42b2f2..6f5677b86c0 100644 --- a/libs/logic-apps-shared/src/utils/src/lib/helpers/__test__/stringFunctions.spec.ts +++ b/libs/logic-apps-shared/src/utils/src/lib/helpers/__test__/stringFunctions.spec.ts @@ -1,6 +1,6 @@ -import { labelCase } from '../stringFunctions'; -import { describe, vi, beforeEach, afterEach, beforeAll, afterAll, it, test, expect } from 'vitest'; -describe('lib/helpers/stringFunctions', () => { +import { idDisplayCase, labelCase } from '../stringFunctions'; +import { describe, it, expect } from 'vitest'; +describe('label_case', () => { it('should replace _ with spaces', () => { expect(labelCase('Test_Test2')).toEqual('Test Test2'); }); @@ -9,3 +9,21 @@ describe('lib/helpers/stringFunctions', () => { expect(labelCase('Test_Test2_Test3_Test4')).toEqual('Test Test2 Test3 Test4'); }); }); + +describe('idDisplayCase', () => { + it('should correctly format a string with an ID tag', () => { + expect(idDisplayCase('Test_ID-#Scope')).toEqual('Test ID'); + }); + + it('should correctly format a string without an ID tag', () => { + expect(idDisplayCase('Test_ID')).toEqual('Test ID'); + }); + + it('should handle an empty string', () => { + expect(idDisplayCase('')).toEqual(''); + }); + + it('should handle a string with only an ID tag', () => { + expect(idDisplayCase('-#Scope')).toEqual(''); + }); +}); \ No newline at end of file