Skip to content

Commit

Permalink
test(designer): Add tests for display of scope ids (#4792)
Browse files Browse the repository at this point in the history
* test(designer): Add tests for display of scope ids

* test(designer): Add tests for display of scope ids
  • Loading branch information
hartra344 committed May 7, 2024
1 parent fcb6bfb commit 696d2ea
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/coverage-report.yml
Expand Up @@ -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:
Expand Down
@@ -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');
});
Expand All @@ -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('');
});
});

0 comments on commit 696d2ea

Please sign in to comment.