[{'Text': '"""Assert mongosh insert scripts include Prisma-required fields (BSON Date, is_archived)."""\n\nfrom unittest.mock import patch\n\nimport pytest\n\n\n@pytest.fixture\ndef sample_stat_doc():\n    return {\n        "type": "broadband",\n        "country": "United Kingdom",\n        "operator": "TestOp",\n        "operatorId": "507f1f77bcf86cd799439011",\n        "period": "2025Q1",\n        "tech": "FTTP",\n        "channel": "Infrastructure",\n        "domain": "Residential",\n        "subscribers": 100,\n        "is_estimate": False,\n        "restated": False,\n        "notes": None,\n        "createdBy": "test",\n    }\n\n\n@pytest.fixture\ndef sample_source_doc():\n    return {\n        "operatorId": "507f1f77bcf86cd799439011",\n        "year": 2025,\n        "quarter": 1,\n        "type": "report",\n        "url": "https://example.com/x",\n    }\n\n\ndef test_insert_one_statistic_includes_bson_dates_and_archived(sample_stat_doc):\n    from point_topic_mcp.core.mongodb_utils import insert_one_statistic\n\n    captured = []\n\n    def fake_run(js: str, timeout: int = 15) -> str:\n        captured.append(js)\n        return \'{"$oid":"507f1f77bcf86cd799439011"}\'\n\n    with (\n        patch("point_topic_mcp.core.mongodb_utils._run_mongosh", side_effect=fake_run),\n        patch.dict("os.environ", {"PT_RESEARCH_DATABASE_URI": "mongodb://localhost:27017/t"}, clear=False),\n    ):\n        insert_one_statistic(sample_stat_doc)\n\n    js = captured[0]\n    assert "const now = new Date()" in js\n    assert "date: now" in js\n    assert "createdAt: now" in js\n    assert "updatedAt: now" in js\n    assert "is_archived: false" in js\n\n\ndef test_insert_one_source_includes_bson_dates(sample_source_doc):\n    from point_topic_mcp.core.mongodb_utils import insert_one_source\n\n    captured = []\n\n    def fake_run(js: str, timeout: int = 15) -> str:\n        captured.append(js)\n        return \'{"$oid":"507f1f77bcf86cd799439012"}\'\n\n    with (\n        patch("point_topic_mcp.core.mongodb_utils._run_mongosh", side_effect=fake_run),\n        patch.dict("os.environ", {"PT_RESEARCH_DATABASE_URI": "mongodb://localhost:27017/t"}, clear=False),\n    ):\n        insert_one_source(sample_source_doc)\n\n    js = captured[0]\n    assert "const now = new Date()" in js\n    assert "createdAt: now" in js\n    assert "updatedAt: now" in js\n'}]