-
-
Save rvansa/ba5be94ba3bf7ae39a91 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function cache() { | |
get = function(k) { | |
return function(client) { | |
return client.get(k); | |
} | |
} | |
put = function(k, v) { | |
return function(client) { | |
return client.put(k, v); | |
} | |
} | |
} | |
var before = client.stats().then(function(beforeStats) { return beforeStats } ); | |
var put = before.then(cache().put('k', 'v')); | |
var after = put.then(function() { return client.stats(); }); | |
Promise.all([before, after]).then(function(results) { | |
// results is an array of 2 elements, with the stats before and stats after | |
expect(results[1].stores).toBe(results[0].stores + 1); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment