A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
/* Copyright 2026 Marimo. All rights reserved. */
import { createStore } from "jotai";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { addSession, agentSessionStateAtom, selectedTabAtom } from "../state";
describe("Jotai atoms", () => {
let store: ReturnType<typeof createStore>;
beforeEach(() => {
store = createStore();
vi.useFakeTimers();
vi.setSystemTime(new Date("2025-01-01T00:00:00Z"));
});
afterEach(() => {
vi.useRealTimers();
});
describe("agentSessionStateAtom", () => {
it("should have initial empty state", () => {
const state = store.get(agentSessionStateAtom);
expect(state).toEqual({
sessions: [],
activeTabId: null,
});
});
});
describe("activeSessionAtom", () => {
it("should return null when no active session", () => {
const activeSession = store.get(selectedTabAtom);
expect(activeSession).toBe(null);
});
it("should return active session when available", () => {
const state = addSession(
{
sessions: [],
activeTabId: null,
},
{ agentId: "gemini" },
);
store.set(agentSessionStateAtom, state);
const activeSession = store.get(selectedTabAtom);
expect(activeSession).toEqual(
expect.objectContaining({
agentId: "gemini",
title: "New gemini session",
}),
);
});
});
});