Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(nodecli): ユニットテストのセクション、目次とサンプルコード #210

Merged
merged 5 commits into from
Apr 2, 2017

Conversation

lacolaco
Copy link
Collaborator

#7

<p>これはHTMLです</p>
`.trim();

assert.deepStrictEqual(md2html(markdown), expected);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

=== にする

@lacolaco lacolaco requested a review from azu March 24, 2017 03:11
@lacolaco
Copy link
Collaborator Author

@azu テストコードの

const markdown = `
...
`.trim()

あたり、どう思います?特に trim()あたり

@azu
Copy link
Collaborator

azu commented Mar 24, 2017

実際やるなら、 actual.html と expeceted.md をファイルとして作って比較できるようにするかなー
(ファイル置くだけでテストケース増やせるので)

.trim(); は微妙そう

@lacolaco
Copy link
Collaborator Author

fixtures/*/expected.md を巡回してすべてケースとしてテスト走らせる? この章でそこまでやることはないと思うので、ファイル化だけにしてrequireで取ってきて使ってみますか fs.readFileのほうがよいですかね?

@azu
Copy link
Collaborator

azu commented Mar 24, 2017

ファイルとして置いてfs.readFileSyncでもいい気はする(テストだし同期でいいんじゃねという話もできそう)

requireだとNodeは読めないのでは。

const fs = require("fs");
const md2html = require("../md2html");

it("default options", () => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

itを日本語にするか問題

const md2html = require("../md2html");

it("default options", () => {
const sample = fs.readFileSync("test/fixtures/sample.md", "utf8");
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

微妙に requireと相対パス解決が違う __dirnameとpath.joinで解決するか

const markdown = `
これはサンプルです。
https://asciidwango.github.io/js-primer/
it("default options", () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

itはもっと説明的な内容でもいい気がする。
日本語でも良さそうではあるけど

@lacolaco
Copy link
Collaborator Author

lacolaco commented Apr 2, 2017

とりあえずこれで

@lacolaco lacolaco merged commit 73d8192 into master Apr 2, 2017
@lacolaco lacolaco deleted the nodecli-unittest-draft branch April 2, 2017 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants