From 012d7d9851b6fd6a0d4984bd3319cc43d779496d Mon Sep 17 00:00:00 2001 From: Neeraj-gagat Date: Fri, 26 Dec 2025 19:25:10 +0530 Subject: [PATCH] added test(setupguide) for utils.ts --- .../SetupGuide/__tests__/utils.test.ts | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 frontend/src/components/HomeComponents/SetupGuide/__tests__/utils.test.ts diff --git a/frontend/src/components/HomeComponents/SetupGuide/__tests__/utils.test.ts b/frontend/src/components/HomeComponents/SetupGuide/__tests__/utils.test.ts new file mode 100644 index 00000000..f59241eb --- /dev/null +++ b/frontend/src/components/HomeComponents/SetupGuide/__tests__/utils.test.ts @@ -0,0 +1,39 @@ +import { url } from '@/components/utils/URLs'; +import { exportConfigSetup } from '../utils'; + +describe('exportConfigSetup', () => { + test('generate correct configuration setup', () => { + const props = { + encryption_secret: 'encryptionSecret', + uuid: 'clients-uuid', + } as any; + + const result = exportConfigSetup(props); + + expect(result).toContain( + 'Configure Taskwarrior with these commands, run these commands one block at a time' + ); + + expect(result).toContain( + `task config sync.encryption_secret ${props.encryption_secret}` + ); + + expect(result).toContain( + `task config sync.server.origin ${url.containerOrigin}` + ); + + expect(result).toContain(`task config sync.server.client_id ${props.uuid}`); + }); + + test('returns string seprated with newline', () => { + const props = { + encryption_secret: 'encryptionSecret', + uuid: 'clients-uuid', + } as any; + + const result = exportConfigSetup(props); + + const lines = result.split('\n'); + expect(lines.length).toBeGreaterThan(1); + }); +});