/
githubmirror
/
ydb-embedded-ui
Обзор
Документация
Войти
/
githubmirror
/
ydb-embedded-ui
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/components/ConnectToDB/__test__/utils.test.ts
34 строки
1 KB
Артём Муфазалов
feat: add endpoint to connect to db code snippets (#2198)
25 апр 2025, 13:01
Не верифицирован
25 апр 2025, 13:01
6e45802
Код
Авторство
О чём код?
import {prepareEndpoint} from '../utils'; describe('prepareEndpoint', () => { test('should remove all search params', () => { const input = 'grpc://example.com:2139/?database=/root/test¶m=value'; const expected = 'grpc://example.com:2139'; expect(prepareEndpoint(input)).toBe(expected); }); test('should handle URL without path or params', () => { const input = 'grpc://example.com:2139'; const expected = 'grpc://example.com:2139'; expect(prepareEndpoint(input)).toBe(expected); }); test('should remove trailing slash from path', () => { const input = 'grpc://example.com:2139/'; const expected = 'grpc://example.com:2139'; expect(prepareEndpoint(input)).toBe(expected); }); test('should handle complex paths', () => { const input = 'grpc://example.com:2139/multi/level/path/?database=/root/test'; const expected = 'grpc://example.com:2139/multi/level/path'; expect(prepareEndpoint(input)).toBe(expected); }); test('should handle empty string', () => { expect(prepareEndpoint('')).toBeUndefined(); }); test('should handle undefined input', () => { expect(prepareEndpoint()).toBeUndefined(); }); test('should return undefined for invalid URL', () => { const input = 'invalid-url'; expect(prepareEndpoint(input)).toBeUndefined(); }); });