Fosi Fossil Service
Small teams. Open source. Built on Fossil.

CaaS / Lamina

Unified Management for Fossil Repositories

Public | Owner: CaaS | Default branch: trunk | Last update: 2026-10-25 00:41

Artifact 0d5c5a6505eb64301e5f5ccea9073861f9e9ef5f084f84c8cca25135254e30fe:


-module(nova_controller_tests).
-include_lib("eunit/include/eunit.hrl").

routes_with_module_that_exports_routes_test() ->
    meck:new(test_ctrl, [non_strict, no_link]),
    meck:expect(test_ctrl, routes, fun(dev, _Opts) ->
        [#{routes => [{"/test", fun(_) -> ok end, #{}}]}]
    end),
    Result = nova_controller:routes(test_ctrl, dev),
    ?assertMatch([#{routes := _}], Result),
    meck:unload(test_ctrl).

routes_with_module_no_routes_callback_test() ->
    meck:new(test_ctrl2, [non_strict, no_link]),
    %% Don't define routes/2 — should return []
    Result = nova_controller:routes(test_ctrl2, dev),
    ?assertEqual([], Result),
    meck:unload(test_ctrl2).

routes_with_tuple_test() ->
    meck:new(test_ctrl3, [non_strict, no_link]),
    meck:expect(test_ctrl3, routes, fun(dev, Opts) ->
        val = maps:get(opt, Opts),
        [#{routes => [{"/x", fun(_) -> ok end, #{}}]}]
    end),
    Result = nova_controller:routes({test_ctrl3, #{opt => val}}, dev),
    ?assertMatch([#{routes := _}], Result),
    meck:unload(test_ctrl3).

routes_with_nonexistent_module_test() ->
    Result = nova_controller:routes(totally_fake_module_xyz_123, dev),
    ?assertEqual([], Result).

Clone

You can clone this repository with the following command:

fossil clone https://fosi.dev/CaaS/Lamina

Contribute

The best way to contribute is through e-mail. See the project documentation for more details.