Skip to content

Commit 5c95882

Browse files
sestinjContinue
andcommitted
Remove unnecessary 'as any' casts from uuidv4 mocks
The vi.mock setup already properly types the uuid v4 function to return string, so the 'as any' type assertions are unnecessary and were creating TypeScript smell in the test file. This change improves type safety while maintaining the same test behavior. Co-authored-by: Username <nate@continue.dev> Generated with [Continue](https://continue.dev) Co-Authored-By: Continue <noreply@continue.dev>
1 parent 5e944a0 commit 5c95882

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

extensions/cli/src/session.test.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ describe("SessionManager", () => {
361361
const firstSession = createSession();
362362
const firstSessionId = firstSession.sessionId;
363363

364-
vi.mocked(uuidv4).mockReturnValue("new-uuid-456" as any);
364+
vi.mocked(uuidv4).mockReturnValue("new-uuid-456");
365365

366366
const secondSession = startNewSession();
367367

@@ -382,7 +382,7 @@ describe("SessionManager", () => {
382382
},
383383
];
384384

385-
vi.mocked(uuidv4).mockReturnValue("new-uuid-789" as any);
385+
vi.mocked(uuidv4).mockReturnValue("new-uuid-789");
386386

387387
const session = startNewSession(history);
388388

@@ -393,7 +393,7 @@ describe("SessionManager", () => {
393393
it("should set the new session as current", () => {
394394
const originalSession = createSession();
395395

396-
vi.mocked(uuidv4).mockReturnValue("new-session-id" as any);
396+
vi.mocked(uuidv4).mockReturnValue("new-session-id");
397397

398398
const newSession = startNewSession();
399399
const currentSession = getCurrentSession();
@@ -406,7 +406,7 @@ describe("SessionManager", () => {
406406
describe("session isolation", () => {
407407
it("should not pollute new sessions with previous session history", () => {
408408
// Simulate first CLI session
409-
vi.mocked(uuidv4).mockReturnValue("session-1" as any);
409+
vi.mocked(uuidv4).mockReturnValue("session-1");
410410
const session1 = createSession();
411411
const history1: ChatHistoryItem[] = [
412412
{
@@ -427,7 +427,7 @@ describe("SessionManager", () => {
427427
updateSessionHistory(history1);
428428

429429
// Simulate starting a new CLI session (without --resume)
430-
vi.mocked(uuidv4).mockReturnValue("session-2" as any);
430+
vi.mocked(uuidv4).mockReturnValue("session-2");
431431
const session2 = startNewSession([]);
432432

433433
// New session should have clean state
@@ -439,7 +439,7 @@ describe("SessionManager", () => {
439439

440440
it("should create independent sessions for concurrent operations", () => {
441441
// Create first session with some data
442-
vi.mocked(uuidv4).mockReturnValue("concurrent-1" as any);
442+
vi.mocked(uuidv4).mockReturnValue("concurrent-1");
443443
const session1 = createSession();
444444
updateSessionTitle("Session 1");
445445
updateSessionHistory([
@@ -453,7 +453,7 @@ describe("SessionManager", () => {
453453
]);
454454

455455
// Start a new session
456-
vi.mocked(uuidv4).mockReturnValue("concurrent-2" as any);
456+
vi.mocked(uuidv4).mockReturnValue("concurrent-2");
457457
const session2 = startNewSession([]);
458458

459459
// Verify session2 is clean
@@ -464,7 +464,7 @@ describe("SessionManager", () => {
464464

465465
it("should properly clear session state when transitioning between sessions", () => {
466466
// First session with complex history
467-
vi.mocked(uuidv4).mockReturnValue("complex-session-1" as any);
467+
vi.mocked(uuidv4).mockReturnValue("complex-session-1");
468468
const session1 = createSession();
469469
updateSessionTitle("Complex Session");
470470
const complexHistory: ChatHistoryItem[] = [
@@ -489,7 +489,7 @@ describe("SessionManager", () => {
489489
expect(getCurrentSession().history.length).toBe(2);
490490

491491
// Start fresh session
492-
vi.mocked(uuidv4).mockReturnValue("fresh-session-2" as any);
492+
vi.mocked(uuidv4).mockReturnValue("fresh-session-2");
493493
const session2 = startNewSession([]);
494494

495495
// Verify clean state

0 commit comments

Comments
 (0)