| Index: test/filterStorage_readwrite.js |
| diff --git a/test/filterStorage_readwrite.js b/test/filterStorage_readwrite.js |
| index 740a29935009736bb8fdf8b3504c532b0219243c..288763e628bdad9db226d3385e3f2bfda78e0ef7 100644 |
| --- a/test/filterStorage_readwrite.js |
| +++ b/test/filterStorage_readwrite.js |
| @@ -15,6 +15,8 @@ |
| * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
| */ |
| +/* globals __dirname */ |
| + |
| "use strict"; |
| let {createSandbox, unexpectedError} = require("./_common"); |
| @@ -41,7 +43,7 @@ exports.setUp = function(callback) |
| FilterStorage.addSubscription(Subscription.fromURL("~fl~")); |
| callback(); |
| -} |
| +}; |
| let testData = new Promise((resolve, reject) => |
| { |
| @@ -96,18 +98,17 @@ function testReadWrite(test, withExternal) |
| section.key = section.header + " " + section.data[0]; |
| section.data.sort(); |
| } |
| - sections.sort(function(a, b) |
| + sections.sort((a, b) => |
| { |
| if (a.key < b.key) |
| return -1; |
| else if (a.key > b.key) |
| return 1; |
| - else |
| - return 0; |
| + return 0; |
| }); |
| - return sections.map(function(section) { |
| - return [section.header].concat(section.data).join("\n"); |
| - }).join("\n"); |
| + return sections.map( |
| + section => [section.header].concat(section.data).join("\n") |
| + ).join("\n"); |
| } |
| return testData.then(data => |
| @@ -120,9 +121,11 @@ function testReadWrite(test, withExternal) |
| if (withExternal) |
| { |
| - let subscription = new ExternalSubscription("~external~external subscription ID", "External subscription"); |
| - subscription.filters = [Filter.fromText("foo"), Filter.fromText("bar")]; |
| - FilterStorage.addSubscription(subscription); |
| + { |
| + let subscription = new ExternalSubscription("~external~external subscription ID", "External subscription"); |
| + subscription.filters = [Filter.fromText("foo"), Filter.fromText("bar")]; |
| + FilterStorage.addSubscription(subscription); |
| + } |
| let externalSubscriptions = FilterStorage.subscriptions.filter(subscription => subscription instanceof ExternalSubscription); |
| test.equal(externalSubscriptions.length, 1, "Number of external subscriptions after updateExternalSubscription"); |
| @@ -158,7 +161,7 @@ for (let url of ["~wl~", "~fl~", "~eh~"]) |
| let tempFile = IO.resolveFilePath("temp_patterns1.ini"); |
| tempFile.contents = data; |
| - loadFilters(tempFile, function() |
| + loadFilters(tempFile, () => |
| { |
| test.equal(FilterStorage.subscriptions.length, 0, "Number of filter subscriptions"); |
| }).catch(unexpectedError.bind(test)).then(() => test.done()); |
| @@ -263,7 +266,7 @@ exports.testSavingWithBackups = function(test) |
| { |
| test.equal(backupFile.lastModifiedTime, oldModifiedTime, "Backup not overwritten if it is only 10 seconds old"); |
| - backupFile.lastModifiedTime -= 40*60*60*1000; |
| + backupFile.lastModifiedTime -= 40 * 60 * 60 * 1000; |
| oldModifiedTime = backupFile.lastModifiedTime; |
| return saveFilters(null); |
| }).then(() => |
| @@ -279,7 +282,7 @@ exports.testSavingWithBackups = function(test) |
| { |
| test.equal(backupFile2.lastModifiedTime, oldModifiedTime, "Second backup not overwritten if first one is only 20 seconds old"); |
| - backupFile.lastModifiedTime -= 25*60*60*1000; |
| + backupFile.lastModifiedTime -= 25 * 60 * 60 * 1000; |
| oldModifiedTime = backupFile2.lastModifiedTime; |
| return saveFilters(null); |
| }).then(() => |