tape("configSingleYamlSync", (test) => { test.plan(1); const actual = markdownlint.readConfigSync( "./test/config/config-child.yaml", [ require("js-yaml").safeLoad ]); const expected = require("./config/config-child.json"); test.deepEqual(actual, expected, "Config object not correct."); test.end(); });
test(function (t) { t.ok(false) t.notOk(true) t.equal('foo', 'bar') t.deepEqual({ foo: 1 }, { bar: 1 }) t.end() })
tape("configSingle", (test) => { test.plan(2); markdownlint.readConfig("./test/config/config-child.json", function callback(err, actual) { test.ifError(err); const expected = require("./config/config-child.json"); test.deepEqual(actual, expected, "Config object not correct."); test.end(); }); });
test("fn.toArray", t => { const fn = $.toArray t.deepEqual(fn([]), [], "keeps `[]` as is") t.deepEqual(fn(null), [], "converts `null` to empty array") t.deepEqual(fn(undefined), [], "converts `undefined` to empty array") t.deepEqual(fn(-1), [-1], "converts `-1` to `[-1]`") t.deepEqual(fn(0), [0], "converts `0` to `[0]`") t.deepEqual(fn(1), [1], "converts `1` to `[1]`") t.deepEqual(fn("foo"), ["foo"]) t.deepEqual(fn(["foo"]), ["foo"]) t.end() })
// breaks output formatting test("utils.logging", t => { t.plan(3) Array("log", "error", "alert").forEach(fn => { const out = $[fn](`hello from utils.${fn}`) t.deepEqual(out, $, `can chain with addl helpers (utils.${fn})`) }) // process.env.VERBOSE = true // $.alert("this is an alert") })
tape("configSingleYaml", (test) => { test.plan(2); markdownlint.readConfig( "./test/config/config-child.yaml", [ require("js-yaml").safeLoad ], function callback(err, actual) { test.ifError(err); const expected = require("./config/config-child.json"); test.deepEqual(actual, expected, "Config object not correct."); test.end(); }); });
tape("configAbsolute", (test) => { test.plan(2); markdownlint.readConfig(path.join(__dirname, "config", "config-child.json"), function callback(err, actual) { test.ifError(err); const expected = require("./config/config-child.json"); test.deepEqual(actual, expected, "Config object not correct."); test.end(); }); });
tape("configSingleSync", (test) => { test.plan(1); const actual = markdownlint.readConfigSync("./test/config/config-child.json"); const expected = require("./config/config-child.json"); test.deepEqual(actual, expected, "Config object not correct."); test.end(); });
tape("missingOptions", (test) => { test.plan(2); markdownlint(null, function callback(err, result) { test.ifError(err); test.deepEqual(result, {}, "Did not get empty result for missing options."); test.end(); }); });
tape("configAbsoluteSync", (test) => { test.plan(1); const actual = markdownlint.readConfigSync( path.join(__dirname, "config", "config-child.json")); const expected = require("./config/config-child.json"); test.deepEqual(actual, expected, "Config object not correct."); test.end(); });
test(function (t) { t.ok(true) t.notOk(false) t.equal('foo', 'foo') t.deepEqual({ foo: 1 }, { foo: 1 }) t.end() })
test("fn.toArray", t => { const fn = $.toArray t.deepEqual(fn([]), [], "keeps `[]` as is") t.deepEqual(fn(null), [], "converts `null` to empty array") t.deepEqual(fn(undefined), [], "converts `undefined` to empty array") t.deepEqual(fn(-1), [-1], "converts `-1` to `[-1]`") t.deepEqual(fn(0), [0], "converts `0` to `[0]`") t.deepEqual(fn(1), [1], "converts `1` to `[1]`") t.deepEqual(fn("foo"), ["foo"]) t.deepEqual(fn(["foo"]), ["foo"]) t.end() })