OLD | NEW |
1 'use strict'; | 1 'use strict'; |
2 | 2 |
3 // Sometimes we need to test that using either the name, alias, or UUID | 3 // Sometimes we need to test that using either the name, alias, or UUID |
4 // produces the same result. The following objects help us do that. | 4 // produces the same result. The following objects help us do that. |
5 var generic_access = { | 5 var generic_access = { |
6 alias: 0x1800, | 6 alias: 0x1800, |
7 name: 'generic_access', | 7 name: 'generic_access', |
8 uuid: '00001800-0000-1000-8000-00805f9b34fb' | 8 uuid: '00001800-0000-1000-8000-00805f9b34fb' |
9 }; | 9 }; |
10 var device_name = { | 10 var device_name = { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 return strAlias + '-97e5-4cd7-b9f1-f5a427670c59'; | 73 return strAlias + '-97e5-4cd7-b9f1-f5a427670c59'; |
74 } | 74 } |
75 | 75 |
76 // Function to test that a promise rejects with the expected error type and | 76 // Function to test that a promise rejects with the expected error type and |
77 // message. | 77 // message. |
78 function assert_promise_rejects_with_message(promise, expected, description) { | 78 function assert_promise_rejects_with_message(promise, expected, description) { |
79 return promise.then(() => { | 79 return promise.then(() => { |
80 assert_unreached('Promise should have rejected: ' + description); | 80 assert_unreached('Promise should have rejected: ' + description); |
81 }, error => { | 81 }, error => { |
82 assert_equals(error.name, expected.name, 'Unexpected Error Name:'); | 82 assert_equals(error.name, expected.name, 'Unexpected Error Name:'); |
83 assert_equals(error.message, expected.message, 'Unexpected Error Message:'); | 83 if (expected.message) { |
| 84 assert_equals(error.message, expected.message, 'Unexpected Error Message:'
); |
| 85 } |
84 }); | 86 }); |
85 } | 87 } |
OLD | NEW |