Skip to content

Commit 0f09623

Browse files
committed
Better tests for moveMouse.
1 parent dd6e658 commit 0f09623

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

test/mouse.js

+16-2
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,26 @@ test('Get the initial mouse position.', function(t)
1515

1616
test('Move the mouse.', function(t)
1717
{
18-
t.plan(3);
18+
t.plan(6);
1919
lastKnownPos = robot.moveMouse(0, 0);
20-
t.ok(robot.moveMouse(100, 100), 'successfully moved the mouse.');
20+
t.ok(robot.moveMouse(100, 100) === 1, 'successfully moved the mouse.');
2121
currentPos = robot.getMousePos();
2222
t.ok(currentPos.x === 100, 'mousepos.x is correct.');
2323
t.ok(currentPos.y === 100, 'mousepos.y is correct.');
24+
25+
t.throws(function()
26+
{
27+
robot.moveMouse(0, 1, 2, 3);
28+
}, /Invalid number/, 'move mouse to (0, 1, 2, 3).');
29+
30+
t.throws(function()
31+
{
32+
robot.moveMouse(0);
33+
}, /Invalid number/, 'move mouse to (0).');
34+
35+
t.ok(robot.moveMouse("0", "0") === 1, 'move mouse to ("0", "0").');
36+
37+
});
2438
});
2539

2640
test('Drag the mouse.', function(t)

0 commit comments

Comments
 (0)