Added tests for legend API (WIP)