Use a set to compare surrogate keys, avoiding key order errors
This commit is contained in:
parent
4d3c21f1bc
commit
8d4ebc171b
@ -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