import unittest

from evennia_tools.layout import EXITS, OBJECTS, grouped_exits, room_keys


class TestEvenniaLayout(unittest.TestCase):
    def test_first_wave_rooms_are_exact(self):
        self.assertEqual(room_keys(), ("Gate", "Courtyard", "Workshop", "Archive", "Chapel"))

    def test_all_exit_endpoints_exist(self):
        keys = set(room_keys())
        for ex in EXITS:
            self.assertIn(ex.source, keys)
            self.assertIn(ex.destination, keys)

    def test_courtyard_is_navigation_hub(self):
        exits = grouped_exits()["Courtyard"]
        destinations = {ex.destination for ex in exits}
        self.assertEqual(destinations, {"Gate", "Workshop", "Archive", "Chapel"})

    def test_objects_live_in_known_rooms(self):
        keys = set(room_keys())
        for obj in OBJECTS:
            self.assertIn(obj.location, keys)


if __name__ == "__main__":
    unittest.main()
