mirror of
https://github.com/eigent-ai/eigent.git
synced 2026-12-05 05:34:01 +00:00
Co-authored-by: Douglas Lai <115660088+Douglasymlai@users.noreply.github.com> Co-authored-by: Douglas <douglas.ym.lai@gmail.com>
29 lines
1.3 KiB
TypeScript
29 lines
1.3 KiB
TypeScript
// ========= Copyright 2025-2026 @ Eigent.ai All Rights Reserved. =========
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
// ========= Copyright 2025-2026 @ Eigent.ai All Rights Reserved. =========
|
|
|
|
import { formatSplittingElapsed } from '@/components/ChatBox/MessageItem/TokenUtils';
|
|
import { describe, expect, it } from 'vitest';
|
|
|
|
describe('formatSplittingElapsed', () => {
|
|
it('formats seconds and minutes below one hour', () => {
|
|
expect(formatSplittingElapsed(59_999)).toBe('59s');
|
|
expect(formatSplittingElapsed(60_000)).toBe('1m 00s');
|
|
expect(formatSplittingElapsed(3_599_999)).toBe('59m 59s');
|
|
});
|
|
|
|
it('rolls minutes into hours at 60 minutes', () => {
|
|
expect(formatSplittingElapsed(3_600_000)).toBe('1h 00m 00s');
|
|
expect(formatSplittingElapsed(3_665_000)).toBe('1h 01m 05s');
|
|
});
|
|
});
|