This repository has been archived by the owner on Apr 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rebase, update dep versions, make code easier to test, add some test …
…coverage
- Loading branch information
1 parent
af62076
commit 76b6cdf
Showing
4 changed files
with
159 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
/* globals describe, it, before, after */ | ||
|
||
var assert = require('assert') | ||
var cli = require('../bin/marky-markdown') | ||
var fixtures = require('./fixtures') | ||
var mock = require('mock-fs') | ||
|
||
var filename = '/some/file.md' | ||
var fileContents = fixtures.basic | ||
|
||
describe('$ marky-markdown', function () { | ||
before(function () { | ||
var mockObj = {} | ||
mockObj[filename] = fileContents | ||
mock(mockObj) | ||
}) | ||
|
||
after(function () { | ||
mock.restore() | ||
}) | ||
|
||
describe('exported properly', function () { | ||
it('is specified in package.json', function () { | ||
assert(require('../package.json').bin === './bin/marky-markdown.js') | ||
}) | ||
|
||
it('is a function', function () { | ||
assert(cli) | ||
assert(typeof cli === 'function') | ||
}) | ||
}) | ||
|
||
describe('handles options', function () { | ||
it("doesn't require any options", function (cb) { | ||
cli([filename], function (err, args) { | ||
assert(!err) | ||
cb() | ||
}) | ||
}) | ||
|
||
it('--sanitize', function (cb) { | ||
cli(['--sanitize', filename], function (err, args) { | ||
assert(!err) | ||
assert(args[1].sanitize) | ||
cb() | ||
}) | ||
}) | ||
|
||
it('--no-sanitize', function (cb) { | ||
cli(['--no-sanitize', filename], function (err, args) { | ||
assert(!err) | ||
assert(!args[1].sanitize) | ||
cb() | ||
}) | ||
}) | ||
|
||
it('--linkify', function (cb) { | ||
cli(['--linkify', filename], function (err, args) { | ||
assert(!err) | ||
assert(args[1].linkify) | ||
cb() | ||
}) | ||
}) | ||
|
||
it('--no-linkify', function (cb) { | ||
cli(['--no-linkify', filename], function (err, args) { | ||
assert(!err) | ||
assert(!args[1].linkify) | ||
cb() | ||
}) | ||
}) | ||
|
||
it('--highlight', function (cb) { | ||
cli(['--highlight', filename], function (err, args) { | ||
assert(!err) | ||
assert(args[1].highlightSyntax) | ||
cb() | ||
}) | ||
}) | ||
|
||
it('--no-highlight', function (cb) { | ||
cli(['--no-highlight', filename], function (err, args) { | ||
assert(!err) | ||
assert(!args[1].highlightSyntax) | ||
cb() | ||
}) | ||
}) | ||
|
||
it('--prefix', function (cb) { | ||
cli(['--prefix', filename], function (err, args) { | ||
assert(!err) | ||
assert(args[1].prefixHeadingIds) | ||
cb() | ||
}) | ||
}) | ||
|
||
it('--no-prefix', function (cb) { | ||
cli(['--no-prefix', filename], function (err, args) { | ||
assert(!err) | ||
assert(!args[1].prefixHeadingIds) | ||
cb() | ||
}) | ||
}) | ||
|
||
it('--cdn', function (cb) { | ||
cli(['--cdn', filename], function (err, args) { | ||
assert(!err) | ||
assert(args[1].serveImagesWithCDN) | ||
cb() | ||
}) | ||
}) | ||
|
||
it('--no-cdn', function (cb) { | ||
cli(['--no-cdn', filename], function (err, args) { | ||
assert(!err) | ||
assert(!args[1].serveImagesWithCDN) | ||
cb() | ||
}) | ||
}) | ||
}) | ||
}) |
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