Skip to content
This repository has been archived by the owner on Feb 29, 2020. It is now read-only.

Commit

Permalink
chore(addon): Fix invalid template strings in addon/MetadataStore.js
Browse files Browse the repository at this point in the history
  • Loading branch information
pdehaan authored and ncloudioj committed Nov 10, 2016
1 parent de82ef0 commit 0a139ef
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
5 changes: 3 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
activity-streams-env/
addon/SimpleStorage.js
addon/ColorAnalyzer.js
addon/SimpleStorage.js
common/vendor.js
data/content/
firefox/
logs/
test/test-SimpleStorage.js
stats.json
test/test-ColorAnalyzer.js
test/test-SimpleStorage.js
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@
"no-sparse-arrays": 2,
"no-sync": 2,
"no-tabs": 2,
"no-template-curly-in-string": 2,
"no-ternary": 0,
"no-this-before-super": 2,
"no-throw-literal": 2,
Expand Down
6 changes: 3 additions & 3 deletions addon/MetadataStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ MetadataStore.prototype = {
);
}
catch (e) {
Cu.reportError("Failed to fetch metadata by cacheKey: ${e.message}");
Cu.reportError(`Failed to fetch metadata by cacheKey: ${e.message}`);
throw e;
}

Expand All @@ -475,7 +475,7 @@ MetadataStore.prototype = {
}
);
} catch (e) {
Cu.reportError("Failed to fetch metadata by cacheKey: ${e.message}");
Cu.reportError(`Failed to fetch metadata by cacheKey: ${e.message}`);
throw e;
}
for (let image of images) {
Expand All @@ -496,7 +496,7 @@ MetadataStore.prototype = {
});
break;
default:
throw new Error("Fetched unknown image types: {image.type}");
throw new Error(`Fetched unknown image types: ${image.type}`);
}
}
}
Expand Down
10 changes: 9 additions & 1 deletion content-test/lib/getRelativeTime.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,26 @@ describe("getRelativeTime", () => {
assert.equal(getRelativeTime(moment().valueOf()), "<1m");
assert.equal(getRelativeTime(moment().subtract(30, "seconds").valueOf()), "<1m");
});

// eslint-disable-next-line no-template-curly-in-string
it("should show ${n}m for ~minutes", () => {
assert.equal(getRelativeTime(moment().subtract(1, "minutes").valueOf()), "1m");
assert.equal(getRelativeTime(moment().subtract(5, "minutes").valueOf()), "5m");
});

// eslint-disable-next-line no-template-curly-in-string
it("should show ${n}h for ~hours", () => {
assert.equal(getRelativeTime(moment().subtract(1, "hours").valueOf()), "1h");
assert.equal(getRelativeTime(moment().subtract(5, "hours").valueOf()), "5h");
});
it("should show ${n}h for ~days", () => {

// eslint-disable-next-line no-template-curly-in-string
it("should show ${n}d for ~days", () => {
assert.equal(getRelativeTime(moment().subtract(1, "days").valueOf()), "1d");
assert.equal(getRelativeTime(moment().subtract(5, "days").valueOf()), "5d");
});

// eslint-disable-next-line no-template-curly-in-string
it("should show ${n}y for ~years", () => {
assert.equal(getRelativeTime(moment().subtract(1, "years").valueOf()), "1y");
assert.equal(getRelativeTime(moment().subtract(5, "years").valueOf()), "5y");
Expand Down

0 comments on commit 0a139ef

Please sign in to comment.