diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-12-18 11:39:00 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-12-18 11:39:00 +0100 |
commit | 76fe52eb81db323ceaa8396de39b76efbce1c25e (patch) | |
tree | 061c409281374d893f9730f89e6a4ef32d0b53f9 /services/sync/modules-testing/fakeservices.js | |
parent | 63635e38ff9341c02fae7f4557d230ec710947b6 (diff) | |
parent | 680c3eadb6aaec1f3653636db081a519e0f62ef5 (diff) | |
download | UXP-76fe52eb81db323ceaa8396de39b76efbce1c25e.tar UXP-76fe52eb81db323ceaa8396de39b76efbce1c25e.tar.gz UXP-76fe52eb81db323ceaa8396de39b76efbce1c25e.tar.lz UXP-76fe52eb81db323ceaa8396de39b76efbce1c25e.tar.xz UXP-76fe52eb81db323ceaa8396de39b76efbce1c25e.zip |
Merge branch 'master' into Basilisk-releasev2018.12.18
Diffstat (limited to 'services/sync/modules-testing/fakeservices.js')
-rw-r--r-- | services/sync/modules-testing/fakeservices.js | 30 |
1 files changed, 1 insertions, 29 deletions
diff --git a/services/sync/modules-testing/fakeservices.js b/services/sync/modules-testing/fakeservices.js index 2895736df..d8f73e981 100644 --- a/services/sync/modules-testing/fakeservices.js +++ b/services/sync/modules-testing/fakeservices.js @@ -22,20 +22,6 @@ this.FakeFilesystemService = function FakeFilesystemService(contents) { this.fakeContents = contents; let self = this; - // Save away the unmocked versions of the functions we replace here for tests - // that really want the originals. As this may be called many times per test, - // we must be careful to not replace them with ones we previously replaced. - // (And WTF are we bothering with these mocks in the first place? Is the - // performance of the filesystem *really* such that it outweighs the downside - // of not running our real JSON functions in the tests? Eg, these mocks don't - // always throw exceptions when the real ones do. Anyway...) - for (let name of ["jsonSave", "jsonLoad", "jsonMove", "jsonRemove"]) { - let origName = "_real_" + name; - if (!Utils[origName]) { - Utils[origName] = Utils[name]; - } - } - Utils.jsonSave = function jsonSave(filePath, that, obj, callback) { let json = typeof obj == "function" ? obj.call(that) : obj; self.fakeContents["weave/" + filePath + ".json"] = JSON.stringify(json); @@ -50,18 +36,6 @@ this.FakeFilesystemService = function FakeFilesystemService(contents) { } cb.call(that, obj); }; - - Utils.jsonMove = function jsonMove(aFrom, aTo, that) { - const fromPath = "weave/" + aFrom + ".json"; - self.fakeContents["weave/" + aTo + ".json"] = self.fakeContents[fromPath]; - delete self.fakeContents[fromPath]; - return Promise.resolve(); - }; - - Utils.jsonRemove = function jsonRemove(filePath, that) { - delete self.fakeContents["weave/" + filePath + ".json"]; - return Promise.resolve(); - }; }; this.fakeSHA256HMAC = function fakeSHA256HMAC(message) { @@ -76,9 +50,7 @@ this.FakeGUIDService = function FakeGUIDService() { let latestGUID = 0; Utils.makeGUID = function makeGUID() { - // ensure that this always returns a unique 12 character string - let nextGUID = "fake-guid-" + String(latestGUID++).padStart(2, "0"); - return nextGUID.slice(nextGUID.length-12, nextGUID.length); + return "fake-guid-" + latestGUID++; }; } |