The front-end approach is the best approach, and not necessarily brute force. As for the problem of actually testing the method - well, if it just reads from $ wnd.jsonData, there is no use in testing the method. You better write a server-side test that confirms that you have the correct data on the main page.
If you really have logic in your own method, you'd better write a test case of selenium / jsunit.
source share