ui: Constants refactor (#26908)

* refactor: Constants

* refactor: Constants/Enums cleanup

* refactor: Constant objects instead of multiple single value constants

* refactor: Cleanup constants
This commit is contained in:
Aleksander Grygier
2026-08-13 06:53:56 +02:00
committed by GitHub
parent 8e7f22b67e
commit e21152dc96
209 changed files with 1101 additions and 1137 deletions
@@ -1,4 +1,4 @@
import { GLOB_WILDCARD, PATH_NAV_MAX_DEPTH } from '$lib/constants';
import { GLOB, SEARCH } from '$lib/constants';
import {
buildCaseInsensitiveGlob,
buildGlobSearchArgs,
@@ -148,7 +148,7 @@ describe('buildGlobSearchArgs', () => {
expect(args.path).toBe('~');
expect(args.include).toBe(buildCaseInsensitiveGlob('proj'));
expect(args.maxDepth).toBe(PATH_NAV_MAX_DEPTH);
expect(args.maxDepth).toBe(SEARCH.PATH_NAV_MAX_DEPTH);
expect(args.rankQuery).toBe('proj');
expect(args.last).toBe('proj');
});
@@ -157,8 +157,8 @@ describe('buildGlobSearchArgs', () => {
const args = buildGlobSearchArgs('~/', '/home', DEPTH);
expect(args.path).toBe('~');
expect(args.include).toBe(GLOB_WILDCARD);
expect(args.maxDepth).toBe(PATH_NAV_MAX_DEPTH);
expect(args.include).toBe(GLOB.WILDCARD);
expect(args.maxDepth).toBe(SEARCH.PATH_NAV_MAX_DEPTH);
});
it('navigates an absolute path under its root', () => {
@@ -166,7 +166,7 @@ describe('buildGlobSearchArgs', () => {
expect(args.path).toBe('/usr/local');
expect(args.include).toBe(buildCaseInsensitiveGlob('bin'));
expect(args.maxDepth).toBe(PATH_NAV_MAX_DEPTH);
expect(args.maxDepth).toBe(SEARCH.PATH_NAV_MAX_DEPTH);
expect(args.rankQuery).toBe('bin');
expect(args.last).toBe('bin');
});