[ { "name": "three values across a padded box", "args": [[1, 3, 2], 100, 20, 2], "expect": { "path": "M2,18L50,2L98,10", "end": { "x": 98, "y": 10 } } }, { "name": "a gap breaks the line; a lone point before it is closed into a dot", "args": [[5, null, 7, 6], 64, 24, 2], "expect": { "path": "M2,22ZM42,2L62,12", "end": { "x": 62, "y": 12 } } }, { "name": "a trailing gap: the end marker is the last real value, not the last slot", "args": [[1, 2, null], 20, 10, 0], "expect": { "path": "M0,10L10,0", "end": { "x": 10, "y": 0 } } }, { "name": "a flat series runs along the middle instead of dividing by zero", "args": [[4, 4, 4], 30, 10, 0], "expect": { "path": "M0,5L15,5L30,5", "end": { "x": 30, "y": 5 } } }, { "name": "a single value sits at the right-hand end, in the middle", "args": [[9], 40, 10, 1], "expect": { "path": "M39,5Z", "end": { "x": 39, "y": 5 } } }, { "name": "thirds are rounded to 2 places in the path", "args": [[0, 1, 2, 3], 10, 10, 0], "expect": { "path": "M0,10L3.33,6.67L6.67,3.33L10,0", "end": { "x": 10, "y": 0 } } }, { "name": "negative values: the lowest is at the bottom", "args": [[-2, 2], 10, 10, 0], "expect": { "path": "M0,10L10,0", "end": { "x": 10, "y": 0 } } }, { "name": "every value a gap: nothing to draw", "args": [[null, null], 50, 10, 1], "expect": { "path": "", "end": null } }, { "name": "an empty series: nothing to draw", "args": [[], 50, 10, 1], "expect": { "path": "", "end": null } }, { "name": "padding that leaves no room is an error", "args": [[1, 2], 10, 10, 5], "expectError": "the box is too small for its padding" }, { "name": "a negative width is an error", "args": [[1, 2], -10, 10, 0], "expectError": "width must be a finite number of zero or more" } ]