/
githubmirror
/
ydb-embedded-ui
Обзор
Документация
Войти
/
githubmirror
/
ydb-embedded-ui
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/containers/Tenant/TableFormDialog/__test__/utils.test.ts
77 строк
3 KB
Максим
feat: add topic and table forms (#3909)
28 июл 2026, 12:49
Не верифицирован
28 июл 2026, 12:49
7477f07
Код
Авторство
О чём код?
import {skipToken} from '@reduxjs/toolkit/query'; import {EPathType} from '../../../../types/api/schema/schema'; import {describeOriginalTable, getTableQueryArgs} from '../utils'; describe('TableFormDialog utils', () => { test('describeOriginalTable exposes the current backend ttl column and index columns', () => { const rowTable = describeOriginalTable({ PathDescription: { Self: {Name: 'orders', PathType: EPathType.EPathTypeTable}, Table: { Columns: [], KeyColumnNames: [], TableIndexes: [ { Name: 'by_status', KeyColumnNames: ['status'], DataColumnNames: ['createdAt'], }, ], TTLSettings: {Enabled: {ColumnName: 'createdAt'}}, }, }, } as never); const columnTable = describeOriginalTable({ PathDescription: { Self: {Name: 'events', PathType: EPathType.EPathTypeColumnTable}, ColumnTableDescription: { Schema: {Columns: [], KeyColumnNames: []}, TtlSettings: {Enabled: {ColumnName: 'eventAt'}}, }, }, } as never); expect(rowTable).toMatchObject({ hasTtl: true, ttlColumn: 'createdAt', indexes: [{name: 'by_status', columns: ['status', 'createdAt']}], }); expect(columnTable).toMatchObject({ hasTtl: true, ttlColumn: 'eventAt', }); }); test('getTableQueryArgs preserves meta-proxy context for update mode', () => { expect( getTableQueryArgs({ mode: 'update', path: '/Root/db1/orders', database: '/Root/db1', databaseFullPath: '/Root/db1', useMetaProxy: true, }), ).toEqual({ database: '/Root/db1', path: { path: '/Root/db1/orders', databaseFullPath: '/Root/db1', useMetaProxy: true, }, }); }); test('getTableQueryArgs skips the load query outside update mode', () => { expect( getTableQueryArgs({ mode: 'create', path: '/Root/db1/orders', database: '/Root/db1', databaseFullPath: '/Root/db1', useMetaProxy: true, }), ).toBe(skipToken); }); });