mirror of
https://github.com/labring/FastGPT.git
synced 2026-05-11 01:02:01 +08:00
289da0f7b0
* sandbox-sync-agent * refactor: host pro as submodule * chore: checkpoint host pro restructure * refactor workspace test layout and startup init * chore: update next turbopack setup * chore: snapshot current work before actions fix * chore: update pro submodule * chore: point pro submodule url to upstream https * fix: Dockerfile * chore: update pro submodule * ci: support private pro submodule token and skip fork jobs * fix(ci): build sdk workspace deps before code-sandbox bundle * fix(app): exclude vitest configs from production typecheck * fix(app-image): build sdk packages before next build * fix(ci): align dockerfiles with workspace sdk build flow * chore(docker): upgrade node20 docker images to node24 * fix(ci): read admin coverage output path in pro test workflow * fix(app-image): include next-i18next config and locale assets * chore: update pro submodule * chore: do not specify branch for submodule * chore: remove most ts-nocheck sign * chore: update pro submodule * chore: remove sandbox-agent-sync package * chore: do not modify "pushData" file logic * fix: health check * chore: restore dev axios proxy state * fix: test-fastgpt report workflow * fix: use valid vitest coverage action inputs
27 lines
991 B
TypeScript
27 lines
991 B
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import { parseParentIdInMongo } from '@fastgpt/global/common/parentFolder/utils';
|
|
|
|
describe('parseParentIdInMongo', () => {
|
|
it('should return empty object for undefined', () => {
|
|
expect(parseParentIdInMongo(undefined)).toEqual({});
|
|
});
|
|
|
|
it('should normalize null or empty string to null parentId', () => {
|
|
expect(parseParentIdInMongo(null)).toEqual({ parentId: null });
|
|
expect(parseParentIdInMongo('')).toEqual({ parentId: null });
|
|
});
|
|
|
|
it('should accept valid 24-char hex id', () => {
|
|
const lowerId = '5f47ac10b58c1b1e3c0a1234';
|
|
const upperId = '5F47AC10B58C1B1E3C0A1234';
|
|
|
|
expect(parseParentIdInMongo(lowerId)).toEqual({ parentId: lowerId });
|
|
expect(parseParentIdInMongo(upperId)).toEqual({ parentId: upperId });
|
|
});
|
|
|
|
it('should ignore invalid parentId', () => {
|
|
expect(parseParentIdInMongo('123')).toEqual({});
|
|
expect(parseParentIdInMongo('5f47ac10b58c1b1e3c0a123g')).toEqual({});
|
|
});
|
|
});
|