Randy Abernethy | 3b9ff4d | 2015-02-16 00:51:24 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Licensed to the Apache Software Foundation (ASF) under one |
| 3 | * or more contributor license agreements. See the NOTICE file |
| 4 | * distributed with this work for additional information |
| 5 | * regarding copyright ownership. The ASF licenses this file |
| 6 | * to you under the Apache License, Version 2.0 (the |
| 7 | * 'License'); you may not use this file except in compliance |
| 8 | * with the License. You may obtain a copy of the License at |
| 9 | * |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | * |
| 12 | * Unless required by applicable law or agreed to in writing, |
| 13 | * software distributed under the License is distributed on an |
| 14 | * 'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | * KIND, either express or implied. See the License for the |
| 16 | * specific language governing permissions and limitations |
| 17 | * under the License. |
| 18 | */ |
| 19 | |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 20 | // This is the Node.js test driver for the standard Apache Thrift |
| 21 | // test service. The driver invokes every function defined in the |
| 22 | // Thrift Test service with a representative range of parameters. |
| 23 | // |
| 24 | // The ThriftTestDriver function requires a client object |
| 25 | // connected to a server hosting the Thrift Test service and |
| 26 | // supports an optional callback function which is called with |
| 27 | // a status message when the test is complete. |
Randy Abernethy | 3b9ff4d | 2015-02-16 00:51:24 -0800 | [diff] [blame] | 28 | |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 29 | const test = require("tape"); |
| 30 | |
| 31 | const helpers = require("./helpers"); |
| 32 | const ttypes = require(`./${helpers.genPath}/ThriftTest_types`); |
| 33 | const TException = require("thrift").Thrift.TException; |
| 34 | const Int64 = require("node-int64"); |
| 35 | const testCases = require("./test-cases"); |
Randy Abernethy | 3b9ff4d | 2015-02-16 00:51:24 -0800 | [diff] [blame] | 36 | |
| 37 | exports.ThriftTestDriver = function(client, callback) { |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 38 | test( |
| 39 | "NodeJS Style Callback Client Tests", |
| 40 | { skip: helpers.ecmaMode === "es6" }, |
| 41 | function(assert) { |
| 42 | const checkRecursively = makeRecursiveCheck(assert); |
Randy Abernethy | 3b9ff4d | 2015-02-16 00:51:24 -0800 | [diff] [blame] | 43 | |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 44 | function makeAsserter(assertionFn) { |
| 45 | return function(c) { |
| 46 | const fnName = c[0]; |
| 47 | const expected = c[1]; |
| 48 | client[fnName](expected, function(err, actual) { |
| 49 | assert.error(err, fnName + ": no callback error"); |
| 50 | assertionFn(actual, expected, fnName); |
| 51 | }); |
| 52 | }; |
Nobuaki Sukegawa | f56b907 | 2015-11-23 19:38:18 +0900 | [diff] [blame] | 53 | } |
Randy Abernethy | 3b9ff4d | 2015-02-16 00:51:24 -0800 | [diff] [blame] | 54 | |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 55 | testCases.simple.forEach( |
| 56 | makeAsserter(function(a, e, m) { |
| 57 | if (a instanceof Int64) { |
| 58 | const e64 = e instanceof Int64 ? e : new Int64(e); |
| 59 | assert.deepEqual(a.buffer, e64.buffer, m); |
| 60 | } else { |
| 61 | assert.equal(a, e, m); |
| 62 | } |
| 63 | }) |
| 64 | ); |
| 65 | testCases.deep.forEach(makeAsserter(assert.deepEqual)); |
| 66 | testCases.deepUnordered.forEach( |
| 67 | makeAsserter(makeUnorderedDeepEqual(assert)) |
| 68 | ); |
Nobuaki Sukegawa | 8a4d06f | 2015-11-06 21:24:26 +0900 | [diff] [blame] | 69 | |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 70 | const arr = []; |
| 71 | for (let i = 0; i < 256; ++i) { |
| 72 | arr[i] = 255 - i; |
| 73 | } |
| 74 | let buf = new Buffer(arr); |
| 75 | client.testBinary(buf, function(err, response) { |
| 76 | assert.error(err, "testBinary: no callback error"); |
| 77 | assert.equal(response.length, 256, "testBinary"); |
| 78 | assert.deepEqual(response, buf, "testBinary(Buffer)"); |
Randy Abernethy | d8187c5 | 2015-02-16 01:25:53 -0800 | [diff] [blame] | 79 | }); |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 80 | buf = new Buffer(arr); |
| 81 | client.testBinary(buf.toString("binary"), function(err, response) { |
| 82 | assert.error(err, "testBinary: no callback error"); |
| 83 | assert.equal(response.length, 256, "testBinary"); |
| 84 | assert.deepEqual(response, buf, "testBinary(string)"); |
| 85 | }); |
Randy Abernethy | d8187c5 | 2015-02-16 01:25:53 -0800 | [diff] [blame] | 86 | |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 87 | client.testMapMap(42, function(err, response) { |
| 88 | const expected = { |
| 89 | "4": { "1": 1, "2": 2, "3": 3, "4": 4 }, |
| 90 | "-4": { "-4": -4, "-3": -3, "-2": -2, "-1": -1 } |
| 91 | }; |
| 92 | assert.error(err, "testMapMap: no callback error"); |
| 93 | assert.deepEqual(expected, response, "testMapMap"); |
| 94 | }); |
| 95 | |
| 96 | client.testStruct(testCases.out, function(err, response) { |
| 97 | assert.error(err, "testStruct: no callback error"); |
| 98 | checkRecursively(testCases.out, response, "testStruct"); |
| 99 | }); |
| 100 | |
| 101 | client.testNest(testCases.out2, function(err, response) { |
| 102 | assert.error(err, "testNest: no callback error"); |
| 103 | checkRecursively(testCases.out2, response, "testNest"); |
| 104 | }); |
| 105 | |
| 106 | client.testInsanity(testCases.crazy, function(err, response) { |
| 107 | assert.error(err, "testInsanity: no callback error"); |
| 108 | checkRecursively(testCases.insanity, response, "testInsanity"); |
| 109 | }); |
| 110 | |
| 111 | client.testInsanity(testCases.crazy2, function(err, response) { |
| 112 | assert.error(err, "testInsanity2: no callback error"); |
| 113 | checkRecursively(testCases.insanity, response, "testInsanity2"); |
| 114 | }); |
| 115 | |
| 116 | client.testException("TException", function(err, response) { |
| 117 | assert.ok( |
| 118 | err instanceof TException, |
| 119 | "testException: correct error type" |
| 120 | ); |
| 121 | assert.ok(!response, "testException: no response"); |
| 122 | }); |
| 123 | |
| 124 | client.testException("Xception", function(err, response) { |
| 125 | assert.ok( |
| 126 | err instanceof ttypes.Xception, |
| 127 | "testException: correct error type" |
| 128 | ); |
| 129 | assert.ok(!response, "testException: no response"); |
| 130 | assert.equal(err.errorCode, 1001, "testException: correct error code"); |
| 131 | assert.equal( |
| 132 | "Xception", |
| 133 | err.message, |
| 134 | "testException: correct error message" |
| 135 | ); |
| 136 | }); |
| 137 | |
| 138 | client.testException("no Exception", function(err, response) { |
| 139 | assert.error(err, "testException: no callback error"); |
| 140 | assert.ok(!response, "testException: no response"); |
| 141 | }); |
| 142 | |
| 143 | client.testOneway(0, function(err, response) { |
| 144 | assert.error(err, "testOneway: no callback error"); |
| 145 | assert.strictEqual(response, undefined, "testOneway: void response"); |
| 146 | }); |
| 147 | |
| 148 | checkOffByOne(function(done) { |
| 149 | client.testI32(-1, function(err, response) { |
| 150 | assert.error(err, "checkOffByOne: no callback error"); |
| 151 | assert.equal(-1, response); |
| 152 | assert.end(); |
| 153 | done(); |
| 154 | }); |
| 155 | }, callback); |
| 156 | } |
| 157 | ); |
| 158 | |
| 159 | // ES6 does not support callback style |
| 160 | if (helpers.ecmaMode === "es6") { |
| 161 | checkOffByOne(done => done(), callback); |
| 162 | } |
Randy Abernethy | 3b9ff4d | 2015-02-16 00:51:24 -0800 | [diff] [blame] | 163 | }; |
| 164 | |
| 165 | exports.ThriftTestDriverPromise = function(client, callback) { |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 166 | test("Promise Client Tests", function(assert) { |
| 167 | const checkRecursively = makeRecursiveCheck(assert); |
Randy Abernethy | 3b9ff4d | 2015-02-16 00:51:24 -0800 | [diff] [blame] | 168 | |
Randy Abernethy | d8187c5 | 2015-02-16 01:25:53 -0800 | [diff] [blame] | 169 | function makeAsserter(assertionFn) { |
| 170 | return function(c) { |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 171 | const fnName = c[0]; |
| 172 | const expected = c[1]; |
Randy Abernethy | d8187c5 | 2015-02-16 01:25:53 -0800 | [diff] [blame] | 173 | client[fnName](expected) |
| 174 | .then(function(actual) { |
| 175 | assertionFn(actual, expected, fnName); |
| 176 | }) |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 177 | .catch(() => assert.fail("fnName")); |
Randy Abernethy | d8187c5 | 2015-02-16 01:25:53 -0800 | [diff] [blame] | 178 | }; |
| 179 | } |
Randy Abernethy | 3b9ff4d | 2015-02-16 00:51:24 -0800 | [diff] [blame] | 180 | |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 181 | testCases.simple.forEach( |
| 182 | makeAsserter(function(a, e, m) { |
| 183 | if (a instanceof Int64) { |
| 184 | const e64 = e instanceof Int64 ? e : new Int64(e); |
| 185 | assert.deepEqual(a.buffer, e64.buffer, m); |
| 186 | } else { |
| 187 | assert.equal(a, e, m); |
| 188 | } |
| 189 | }) |
| 190 | ); |
Randy Abernethy | d8187c5 | 2015-02-16 01:25:53 -0800 | [diff] [blame] | 191 | testCases.deep.forEach(makeAsserter(assert.deepEqual)); |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 192 | testCases.deepUnordered.forEach( |
| 193 | makeAsserter(makeUnorderedDeepEqual(assert)) |
| 194 | ); |
Randy Abernethy | 3b9ff4d | 2015-02-16 00:51:24 -0800 | [diff] [blame] | 195 | |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 196 | client |
| 197 | .testStruct(testCases.out) |
Randy Abernethy | 3b9ff4d | 2015-02-16 00:51:24 -0800 | [diff] [blame] | 198 | .then(function(response) { |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 199 | checkRecursively(testCases.out, response, "testStruct"); |
Randy Abernethy | 3b9ff4d | 2015-02-16 00:51:24 -0800 | [diff] [blame] | 200 | }) |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 201 | .catch(() => assert.fail("testStruct")); |
Randy Abernethy | 3b9ff4d | 2015-02-16 00:51:24 -0800 | [diff] [blame] | 202 | |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 203 | client |
| 204 | .testNest(testCases.out2) |
Randy Abernethy | d8187c5 | 2015-02-16 01:25:53 -0800 | [diff] [blame] | 205 | .then(function(response) { |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 206 | checkRecursively(testCases.out2, response, "testNest"); |
Randy Abernethy | d8187c5 | 2015-02-16 01:25:53 -0800 | [diff] [blame] | 207 | }) |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 208 | .catch(() => assert.fail("testNest")); |
Randy Abernethy | d8187c5 | 2015-02-16 01:25:53 -0800 | [diff] [blame] | 209 | |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 210 | client |
| 211 | .testInsanity(testCases.crazy) |
Randy Abernethy | d8187c5 | 2015-02-16 01:25:53 -0800 | [diff] [blame] | 212 | .then(function(response) { |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 213 | checkRecursively(testCases.insanity, response, "testInsanity"); |
Randy Abernethy | d8187c5 | 2015-02-16 01:25:53 -0800 | [diff] [blame] | 214 | }) |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 215 | .catch(() => assert.fail("testInsanity")); |
Randy Abernethy | d8187c5 | 2015-02-16 01:25:53 -0800 | [diff] [blame] | 216 | |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 217 | client |
| 218 | .testInsanity(testCases.crazy2) |
Henrique Mendonça | 15d9042 | 2015-06-25 22:31:41 +1000 | [diff] [blame] | 219 | .then(function(response) { |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 220 | checkRecursively(testCases.insanity, response, "testInsanity2"); |
Henrique Mendonça | 15d9042 | 2015-06-25 22:31:41 +1000 | [diff] [blame] | 221 | }) |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 222 | .catch(() => assert.fail("testInsanity2")); |
Henrique Mendonça | 15d9042 | 2015-06-25 22:31:41 +1000 | [diff] [blame] | 223 | |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 224 | client |
| 225 | .testException("TException") |
| 226 | .then(function() { |
| 227 | assert.fail("testException: TException"); |
Randy Abernethy | d8187c5 | 2015-02-16 01:25:53 -0800 | [diff] [blame] | 228 | }) |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 229 | .catch(function(err) { |
Randy Abernethy | bd60b92 | 2015-02-26 16:59:14 -0800 | [diff] [blame] | 230 | assert.ok(err instanceof TException); |
| 231 | }); |
Randy Abernethy | d8187c5 | 2015-02-16 01:25:53 -0800 | [diff] [blame] | 232 | |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 233 | client |
| 234 | .testException("Xception") |
| 235 | .then(function() { |
| 236 | assert.fail("testException: Xception"); |
Randy Abernethy | d8187c5 | 2015-02-16 01:25:53 -0800 | [diff] [blame] | 237 | }) |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 238 | .catch(function(err) { |
Randy Abernethy | bd60b92 | 2015-02-26 16:59:14 -0800 | [diff] [blame] | 239 | assert.ok(err instanceof ttypes.Xception); |
Randy Abernethy | d8187c5 | 2015-02-16 01:25:53 -0800 | [diff] [blame] | 240 | assert.equal(err.errorCode, 1001); |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 241 | assert.equal("Xception", err.message); |
Randy Abernethy | d8187c5 | 2015-02-16 01:25:53 -0800 | [diff] [blame] | 242 | }); |
| 243 | |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 244 | client |
| 245 | .testException("no Exception") |
Randy Abernethy | d8187c5 | 2015-02-16 01:25:53 -0800 | [diff] [blame] | 246 | .then(function(response) { |
| 247 | assert.equal(undefined, response); //void |
| 248 | }) |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 249 | .catch(() => assert.fail("testException")); |
Randy Abernethy | d8187c5 | 2015-02-16 01:25:53 -0800 | [diff] [blame] | 250 | |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 251 | client |
| 252 | .testOneway(0) |
bforbis | f2867c2 | 2018-07-17 12:19:49 -0400 | [diff] [blame] | 253 | .then(function(response) { |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 254 | assert.strictEqual(response, undefined, "testOneway: void response"); |
bforbis | f2867c2 | 2018-07-17 12:19:49 -0400 | [diff] [blame] | 255 | }) |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 256 | .catch(() => assert.fail("testOneway: should not reject")); |
Randy Abernethy | d8187c5 | 2015-02-16 01:25:53 -0800 | [diff] [blame] | 257 | |
| 258 | checkOffByOne(function(done) { |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 259 | client |
| 260 | .testI32(-1) |
Randy Abernethy | d8187c5 | 2015-02-16 01:25:53 -0800 | [diff] [blame] | 261 | .then(function(response) { |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 262 | assert.equal(-1, response); |
| 263 | assert.end(); |
| 264 | done(); |
Randy Abernethy | d8187c5 | 2015-02-16 01:25:53 -0800 | [diff] [blame] | 265 | }) |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 266 | .catch(() => assert.fail("checkOffByOne")); |
Randy Abernethy | d8187c5 | 2015-02-16 01:25:53 -0800 | [diff] [blame] | 267 | }, callback); |
| 268 | }); |
Randy Abernethy | 3b9ff4d | 2015-02-16 00:51:24 -0800 | [diff] [blame] | 269 | }; |
| 270 | |
Randy Abernethy | 3b9ff4d | 2015-02-16 00:51:24 -0800 | [diff] [blame] | 271 | // Helper Functions |
| 272 | // ========================================================= |
| 273 | |
Randy Abernethy | d8187c5 | 2015-02-16 01:25:53 -0800 | [diff] [blame] | 274 | function makeRecursiveCheck(assert) { |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 275 | return function(map1, map2, msg) { |
| 276 | const equal = checkRecursively(map1, map2); |
Randy Abernethy | d8187c5 | 2015-02-16 01:25:53 -0800 | [diff] [blame] | 277 | |
| 278 | assert.ok(equal, msg); |
| 279 | |
| 280 | // deepEqual doesn't work with fields using node-int64 |
| 281 | function checkRecursively(map1, map2) { |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 282 | if (typeof map1 !== "function" && typeof map2 !== "function") { |
| 283 | if (!map1 || typeof map1 !== "object") { |
Randy Abernethy | d8187c5 | 2015-02-16 01:25:53 -0800 | [diff] [blame] | 284 | //Handle int64 types (which use node-int64 in Node.js JavaScript) |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 285 | if ( |
| 286 | typeof map1 === "number" && |
| 287 | typeof map2 === "object" && |
| 288 | map2.buffer && |
| 289 | map2.buffer instanceof Buffer && |
| 290 | map2.buffer.length === 8 |
| 291 | ) { |
| 292 | const n = new Int64(map2.buffer); |
Randy Abernethy | d8187c5 | 2015-02-16 01:25:53 -0800 | [diff] [blame] | 293 | return map1 === n.toNumber(); |
| 294 | } else { |
| 295 | return map1 == map2; |
| 296 | } |
| 297 | } else { |
| 298 | return Object.keys(map1).every(function(key) { |
| 299 | return checkRecursively(map1[key], map2[key]); |
| 300 | }); |
| 301 | } |
Randy Abernethy | 3b9ff4d | 2015-02-16 00:51:24 -0800 | [diff] [blame] | 302 | } |
| 303 | } |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 304 | }; |
Randy Abernethy | 3b9ff4d | 2015-02-16 00:51:24 -0800 | [diff] [blame] | 305 | } |
| 306 | |
| 307 | function checkOffByOne(done, callback) { |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 308 | const retry_limit = 30; |
| 309 | const retry_interval = 100; |
| 310 | let test_complete = false; |
| 311 | let retrys = 0; |
Randy Abernethy | 3b9ff4d | 2015-02-16 00:51:24 -0800 | [diff] [blame] | 312 | |
| 313 | /** |
| 314 | * redo a simple test after the oneway to make sure we aren't "off by one" -- |
| 315 | * if the server treated oneway void like normal void, this next test will |
| 316 | * fail since it will get the void confirmation rather than the correct |
| 317 | * result. In this circumstance, the client will throw the exception: |
| 318 | * |
| 319 | * Because this is the last test against the server, when it completes |
| 320 | * the entire suite is complete by definition (the tests run serially). |
| 321 | */ |
| 322 | done(function() { |
| 323 | test_complete = true; |
| 324 | }); |
| 325 | |
| 326 | //We wait up to retry_limit * retry_interval for the test suite to complete |
| 327 | function TestForCompletion() { |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 328 | if (test_complete && callback) { |
Randy Abernethy | 3b9ff4d | 2015-02-16 00:51:24 -0800 | [diff] [blame] | 329 | callback("Server successfully tested!"); |
| 330 | } else { |
| 331 | if (++retrys < retry_limit) { |
| 332 | setTimeout(TestForCompletion, retry_interval); |
| 333 | } else if (callback) { |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 334 | callback( |
| 335 | "Server test failed to complete after " + |
| 336 | (retry_limit * retry_interval) / 1000 + |
| 337 | " seconds" |
| 338 | ); |
Randy Abernethy | 3b9ff4d | 2015-02-16 00:51:24 -0800 | [diff] [blame] | 339 | } |
| 340 | } |
| 341 | } |
| 342 | |
| 343 | setTimeout(TestForCompletion, retry_interval); |
| 344 | } |
Randy Abernethy | 983bf7d | 2015-10-09 12:28:57 -0700 | [diff] [blame] | 345 | |
| 346 | function makeUnorderedDeepEqual(assert) { |
| 347 | return function(actual, expected, name) { |
| 348 | assert.equal(actual.length, expected.length, name); |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 349 | for (const k in actual) { |
| 350 | let found = false; |
| 351 | for (const k2 in expected) { |
Randy Abernethy | 983bf7d | 2015-10-09 12:28:57 -0700 | [diff] [blame] | 352 | if (actual[k] === expected[k2]) { |
| 353 | found = true; |
| 354 | } |
| 355 | } |
| 356 | if (!found) { |
bforbis | da1169d | 2018-10-28 11:27:38 -0400 | [diff] [blame] | 357 | assert.fail("Unexpected value " + actual[k] + " with key " + k); |
Randy Abernethy | 983bf7d | 2015-10-09 12:28:57 -0700 | [diff] [blame] | 358 | } |
| 359 | } |
| 360 | }; |
| 361 | } |