Skip to content

Commit

Permalink
Add bad union type validation test
Browse files Browse the repository at this point in the history
  • Loading branch information
Lauren Budorick committed Mar 26, 2018
1 parent b254be8 commit 0d177b4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 0 additions & 2 deletions test/unit/source/canvas_source.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ function createSource(options) {
coordinates: [[0, 0], [1, 0], [1, 1], [0, 1]],
}, options);


const source = new CanvasSource('id', options, { send: function() {} }, options.eventedParent);

source.canvas = c;

return source;
Expand Down
8 changes: 8 additions & 0 deletions test/unit/style-spec/fixture/sources.input.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@
],
"canvas": "canvasId",
"animate": false
},
"canvas-invalid-union-type": {
"type": "canvas",
"coordinates": [
[1, 2], [3, 4], [5, 6], [7, 8]
],
"canvas": 3,
"animate": false
}
},
"layers": []
Expand Down
6 changes: 5 additions & 1 deletion test/unit/style-spec/fixture/sources.output.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,9 @@
{
"message": "sources.video-wrong-coordinates.coordinates[3]: array length 2 expected, length 0 found",
"line": 34
},
{
"message": "sources.canvas-invalid-union-type.canvas: expected one of types [string, HTMLCanvasElement], \"number\" found",
"line": 50
}
]
]

0 comments on commit 0d177b4

Please sign in to comment.