Use a set to compare surrogate keys, avoiding key order errors
This commit is contained in:
parent
6ece30fa2c
commit
3d0c0f34ad
@ -63,7 +63,15 @@ function checkCache(res) {
|
||||
|
||||
function checkSurrogateKey(res, expectedKey) {
|
||||
assert.ok(res.headers.hasOwnProperty('surrogate-key'));
|
||||
assert.equal(res.headers['surrogate-key'], expectedKey);
|
||||
|
||||
function createSet(keys, key) {
|
||||
keys[key] = true;
|
||||
return keys;
|
||||
}
|
||||
var keys = res.headers['surrogate-key'].split(' ').reduce(createSet, {});
|
||||
var expectedKeys = expectedKey.split(' ').reduce(createSet, {});
|
||||
|
||||
assert.deepEqual(keys, expectedKeys);
|
||||
}
|
||||
|
||||
//global afterEach to capture test suites that leave keys in redis
|
||||
|
Loading…
Reference in New Issue
Block a user