summaryrefslogtreecommitdiffstats
path: root/services/sync/modules-testing/fakeservices.js
diff options
context:
space:
mode:
authorMoonchild <mcwerewolf@wolfbeast.com>2018-12-12 11:01:48 +0100
committerGitHub <noreply@github.com>2018-12-12 11:01:48 +0100
commitbc8a25f5e33700f700b1e07b238bef5dae22f1ad (patch)
treec1f1ec816f1a85459d05bd6a4cf4f6170b01c602 /services/sync/modules-testing/fakeservices.js
parentf2d4bd1e395f903355cc157a1de7207e5b22b7fb (diff)
parent9697bfa68f32984b196748e388d743dddbe6aa7b (diff)
downloadUXP-bc8a25f5e33700f700b1e07b238bef5dae22f1ad.tar
UXP-bc8a25f5e33700f700b1e07b238bef5dae22f1ad.tar.gz
UXP-bc8a25f5e33700f700b1e07b238bef5dae22f1ad.tar.lz
UXP-bc8a25f5e33700f700b1e07b238bef5dae22f1ad.tar.xz
UXP-bc8a25f5e33700f700b1e07b238bef5dae22f1ad.zip
Merge pull request #898 from MoonchildProductions/Sync-weave
Remove FxA Phase 1
Diffstat (limited to 'services/sync/modules-testing/fakeservices.js')
-rw-r--r--services/sync/modules-testing/fakeservices.js30
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++;
};
}