anchor.diff:      ?assertEqual(ExpLinks, ListedLinks).
   
   
  -%% @private
  --spec list_all_links_by_chunk(
  -    node(),
  -    listing_method(),
  -    od_space:id(),
  -    atm_workflow_execution:phase(),
  -    atm_workflow_executions_forest:tree_ids(),
  -    atm_workflow_executions_forest:listing_opts(),
  -    [{atm_workflow_execution:id(), atm_workflow_executions_forest:index()}]
  -) ->
  -    [{atm_workflow_execution:id(), atm_workflow_executions_forest:index()}].
  -list_all_links_by_chunk(Node, ListingMethod, SpaceId, Phase, ListedAtmInventoryIds, ListingOpts, LinksAcc) ->
  -    case list_links(Node, SpaceId, Phase, ListedAtmInventoryIds, ListingOpts) of
  -        [] ->
  -            LinksAcc;
  -        ListedLinks ->
  -            list_all_links_by_chunk(
  -                Node, ListingMethod, SpaceId, Phase, ListedAtmInventoryIds,
  -                update_listing_opts(ListingMethod, ListingOpts, ListedLinks),
  -                LinksAcc ++ ListedLinks
  -            )
  -    end.
  -
  -
  -%% @private
  --spec update_listing_opts(
  -    listing_method(),
  -    atm_workflow_executions_forest:listing_opts(),
  -    [{atm_workflow_execution:id(), atm_workflow_executions_forest:index()}]
  -) ->
  -    atm_workflow_executions_forest:listing_opts().
  -update_listing_opts(offset, ListingOpts, ListedLinks) ->
  -    maps:update_with(offset, fun(Offset) -> Offset + length(ListedLinks) end, ListingOpts);
  -update_listing_opts(start_index, ListingOpts, ListedLinks) ->
  -    maps:update(start_index, element(2, lists:last(ListedLinks)), ListingOpts#{offset => 1}).
  -
  -
   %%%===================================================================
   %%% Internal functions
   %%%===================================================================
  
positive.code:     AtmInventoryIds = [str_utils:rand_hex(32), str_utils:rand_hex(32)],
      AllLinks = populate_links(Node, SpaceId, Phase, AtmInventoryIds, AtmInventoryIds, 30),
  
      ?assertEqual(AllLinks, list_links(Node, SpaceId, Phase, all, #{offset => -10})),
      ?assertEqual(AllLinks, list_links(Node, SpaceId, Phase, all, #{offset => -10, limit => 30})),
  
      StartIndex = element(2, lists:nth(20, AllLinks)),
      ExpLinks = lists:sublist(AllLinks, 15, 10),
      ?assertEqual(
          ExpLinks,
  
negative.code:     lists:foreach(fun(InvalidListingOpts) ->
          ?assertEqual(?EINVAL, list_links(KrkNode, SpaceId, Phase, all, InvalidListingOpts))
      end, [
          % Limit and either offset or start_index must be specified
          #{}, #{offset => 0}, #{start_index => 0}, #{limit => 10},
          % Limit lower than 1 is not allowed
          #{offset => 0, limit => -10}, #{offset => 0, limit => 0}, #{offset => 0, limit => all},
          % Offset must be proper integer
          #{offset => <<>>, limit => 10}, #{offset => -2.5, limit => 10},
          % Start index must be proper binary
          #{start_index => 10, limit => 10}
      ]).
  
  
  