mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-09-19 05:59:34 +02:00
toUppercase tool, testCases and updated index file
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import { tool as stringUppercase } from './uppercase/meta';
|
||||||
import { tool as stringExtractSubstring } from './extract-substring/meta';
|
import { tool as stringExtractSubstring } from './extract-substring/meta';
|
||||||
import { tool as stringCreatePalindrome } from './create-palindrome/meta';
|
import { tool as stringCreatePalindrome } from './create-palindrome/meta';
|
||||||
import { tool as stringPalindrome } from './palindrome/meta';
|
import { tool as stringPalindrome } from './palindrome/meta';
|
||||||
|
11
src/pages/string/uppercase/index.tsx
Normal file
11
src/pages/string/uppercase/index.tsx
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import { Box } from '@mui/material';
|
||||||
|
import React from 'react';
|
||||||
|
import * as Yup from 'yup';
|
||||||
|
|
||||||
|
const initialValues = {};
|
||||||
|
const validationSchema = Yup.object({
|
||||||
|
// splitSeparator: Yup.string().required('The separator is required')
|
||||||
|
});
|
||||||
|
export default function Uppercase() {
|
||||||
|
return <Box>Lorem ipsum</Box>;
|
||||||
|
}
|
13
src/pages/string/uppercase/meta.ts
Normal file
13
src/pages/string/uppercase/meta.ts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import { defineTool } from '@tools/defineTool';
|
||||||
|
import { lazy } from 'react';
|
||||||
|
// import image from '@assets/text.png';
|
||||||
|
|
||||||
|
export const tool = defineTool('string', {
|
||||||
|
name: 'Uppercase',
|
||||||
|
path: 'uppercase',
|
||||||
|
// image,
|
||||||
|
description: '',
|
||||||
|
shortDescription: '',
|
||||||
|
keywords: ['uppercase'],
|
||||||
|
component: lazy(() => import('./index'))
|
||||||
|
});
|
3
src/pages/string/uppercase/service.ts
Normal file
3
src/pages/string/uppercase/service.ts
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
export function toUppercase(input: string): string {
|
||||||
|
return input.toUpperCase();
|
||||||
|
}
|
34
src/pages/string/uppercase/uppercase.service.test.ts
Normal file
34
src/pages/string/uppercase/uppercase.service.test.ts
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
import { expect, describe, it } from 'vitest';
|
||||||
|
import { toUppercase } from './service';
|
||||||
|
|
||||||
|
describe('toUppercase', () => {
|
||||||
|
test('should convert a lowercase string to uppercase', () => {
|
||||||
|
const input = 'hello';
|
||||||
|
const result = toUppercase(input);
|
||||||
|
expect(result).toBe('HELLO');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should convert a mixed case string to uppercase', () => {
|
||||||
|
const input = 'HeLLo WoRLd';
|
||||||
|
const result = toUppercase(input);
|
||||||
|
expect(result).toBe('HELLO WORLD');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should convert an already uppercase string to uppercase', () => {
|
||||||
|
const input = 'HELLO';
|
||||||
|
const result = toUppercase(input);
|
||||||
|
expect(result).toBe('HELLO');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should handle an empty string', () => {
|
||||||
|
const input = '';
|
||||||
|
const result = toUppercase(input);
|
||||||
|
expect(result).toBe('');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should handle a string with numbers and symbols', () => {
|
||||||
|
const input = '123 hello! @world';
|
||||||
|
const result = toUppercase(input);
|
||||||
|
expect(result).toBe('123 HELLO! @WORLD');
|
||||||
|
});
|
||||||
|
});
|
Reference in New Issue
Block a user