This repository has been archived by the owner on Sep 7, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 248
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
@phenomic/plugin-transform-asciidoc: minor tweaks to adjust lint/tests
poke @ezralalonde :)
- Loading branch information
Showing
6 changed files
with
30 additions
and
20 deletions.
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ import defaultConfig from "@phenomic/core/lib/defaultConfig.js"; | |
|
||
import transformer from "../transformer.js"; | ||
|
||
const input = ` | ||
const input = new Buffer(` | ||
= Hello, AsciiDoc! | ||
Ezra Lalonde <[email protected]> | ||
v1.0, 2017-10-05: First Draft | ||
|
@@ -18,8 +18,8 @@ Test of Asciidoc.js transformer for Phenomic. | |
[source,javascript] | ||
const name = "Ezra" | ||
console.log(\`Hello, ${name}!\`) | ||
`; | ||
console.log(\`Hello, \${name}!\`) | ||
`); | ||
|
||
it("should render asciidoc as json (react component)", () => { | ||
const adoc = transformer( | ||
|
@@ -40,55 +40,55 @@ it("should render asciidoc as html", () => { | |
it("should have tags", () => { | ||
const adoc = transformer( | ||
defaultConfig, | ||
` | ||
new Buffer(` | ||
= Title | ||
:tags: phenomic, documentation, test, déjà vu | ||
` | ||
`) | ||
); | ||
expect(adoc.tags).toEqual(["phenomic", "documentation", "test", "deja-vu"]); | ||
}); | ||
|
||
it("should not have tags", () => { | ||
const adoc = transformer( | ||
defaultConfig, | ||
` | ||
new Buffer(` | ||
= Title | ||
` | ||
`) | ||
); | ||
expect(adoc.tags).toEqual([]); | ||
}); | ||
|
||
it("should use explicit date attribute for date", () => { | ||
const adoc = transformer( | ||
defaultConfig, | ||
` | ||
new Buffer(` | ||
= Title | ||
Ezra Lalonde <[email protected]> | ||
v1.0, 2017-10-05: First Draft | ||
:date: 2011-12-25 | ||
` | ||
`) | ||
); | ||
expect(adoc.date).toBe("2011-12-25"); | ||
}); | ||
|
||
it("should use revdate for date", () => { | ||
const adoc = transformer( | ||
defaultConfig, | ||
` | ||
new Buffer(` | ||
= Title | ||
Ezra Lalonde <[email protected]> | ||
v1.0, 2017-10-05: First Draft | ||
` | ||
`) | ||
); | ||
expect(adoc.date).toBe("2017-10-05"); | ||
}); | ||
|
||
it("should use have no date attribute", () => { | ||
const adoc = transformer( | ||
defaultConfig, | ||
` | ||
new Buffer(` | ||
= Title | ||
` | ||
`) | ||
); | ||
expect(adoc.date).toBe(undefined); | ||
}); |
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
15cbdf1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
packages/plugin-transform-asciidoc/src/transformer.js
explicitly mutatesconst data
two lines after its definition. Doesn't bother me…Buffer
-ize the transformer, ortoString()
the parameter inindex.js
.I really appreciate your help/support with this.
LGTM, +1, 👍, 🍻, etc.
15cbdf1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For 2.
const
prevent the variable reference to be changed, and does not ensure that you do not change the value (eg: object, array, etc) so it's safe to be used here (and in fact it has been changed by eslint + the config we use)