test("jsonReader", () -> injector = angular.injector(["ng", "sideBySide"]) jsonReader = injector.get("jsonReader") testCases = [{ tested: """ { meta: { Title: "Test leading text" }, content: [ "
This is leading text.
", { section: "I", text: "First section.
" }, { section: "II", text: "Second section.
" }, { text: "Another section.
" }, ], }""" expected: { meta: { Title: "Test leading text" } content: [ { section: "", text: "This is leading text.
" } { section: "I", text: "First section.
" } { section: "II", text: "Second section.
" } { section: "", text: "Another section.
" } ] } }] for testCase in testCases deepEqual(jsonReader(testCase.tested), testCase.expected) )