OLD | NEW |
---|---|
(Empty) | |
1 <!doctype html> | |
2 <html> | |
3 <head> | |
4 <title>Budget API: Makes basic getCost and getBudget calls.</title> | |
5 <script src="../resources/testharness.js"></script> | |
6 <script src="../resources/testharnessreport.js"></script> | |
7 <script src="/js-test-resources/mojo-helpers.js"></script> | |
8 <script src="budget-service-mock.js"></script> | |
9 </head> | |
10 <body> | |
11 <script> | |
12 if (!window.mojo) | |
13 debug('This test can not run without mojo'); | |
14 | |
15 promise_test(function() { | |
16 return budgetServiceMock.then(mock => { | |
17 assert_own_property(Navigator.prototype, 'budget'); | |
18 return navigator.budget.getCost("silent-push"); | |
19 }).then(cost => { | |
20 assert_equals(cost, TEST_BUDGET_COST); | |
Peter Beverloo
2016/08/23 09:46:39
dito. Also on line 29
harkness
2016/08/23 10:06:17
Done.
| |
21 }); | |
22 }, 'BudgetService mock for GetCost should return correct results.'); | |
23 | |
24 promise_test(function() { | |
25 return budgetServiceMock.then(mock => { | |
26 assert_own_property(Navigator.prototype, 'budget'); | |
27 return navigator.budget.getCost("push"); | |
Peter Beverloo
2016/08/23 09:46:39
nit: I'd choose something that's obviously fake. W
harkness
2016/08/23 10:06:17
Done.
| |
28 }).then(cost => { | |
29 assert_unreached('getCost should have failed with an invalid argumen t.'); | |
30 }, function(error) { | |
31 assert_equals(error.name, 'TypeError'); | |
32 assert_equals(error.message, "Failed to execute 'getCost' on 'BudgetSe rvice': The provided value 'push' is not a valid enum value of type ActionType." ); | |
33 }); | |
34 }, 'BudgetService mock for GetCost should return correct results.'); | |
35 </script> | |
36 </body> | |
37 </html> | |
OLD | NEW |