Files
integreat/test/clj/auto_ap/auth/logout_test.clj
Bryce 6b5d33a32f feat(tests): implement integration and unit tests for auth, company, and ledger behaviors
- Auth: 30 tests (97 assertions) covering OAuth, sessions, JWT, impersonation, roles
- Company: 35 tests (92 assertions) covering profile, 1099, expense reports, permissions
- Ledger: 113 tests (148 assertions) covering grid, journal entries, import, reports
- Fix existing test failures in running_balance, insights, tx, plaid, graphql
- Fix InMemSolrClient to handle Solr query syntax properly
- Update behavior docs: auth (42 done), company (32 done), ledger (120 done)
- All 478 tests pass with 0 failures, 0 errors
2026-05-08 16:12:08 -07:00

24 lines
971 B
Clojure

(ns auto-ap.auth.logout-test
(:require
[auto-ap.integration.util :refer [wrap-setup]]
[auto-ap.ssr.auth :as ssr-auth]
[clojure.test :refer [deftest is testing use-fixtures]]))
(use-fixtures :each wrap-setup)
(deftest test-logout
(testing "Behavior 2.1: It should clear the session when the user navigates to /logout"
(let [response (ssr-auth/logout {:session {:identity {:user/role "admin"} :version 2}})]
(is (= {} (:session response)))))
(testing "Behavior 2.2: It should redirect to the login page after logout"
(let [response (ssr-auth/logout {})]
(is (= 301 (:status response)))
(is (= "/login" (get-in response [:headers "Location"])))))
(testing "Behavior 2.3: It should remain idempotent when logging out without an active session"
(let [response (ssr-auth/logout {})]
(is (= 301 (:status response)))
(is (= "/login" (get-in response [:headers "Location"])))
(is (= {} (:session response))))))