var tester = require('gitbook-tester'); var test = require('tape'); var pkg = require('./package.json'); test('highlight javascript code block', function (t) { t.plan(1); tester.builder() .withContent('```js\nfunction() { return true };\n```') .withLocalPlugin(__dirname) .withBookJson({ gitbook: pkg.engines.gitbook, plugins: ['prism', '-highlight'] }) .create() .then(function(result) { var expected = '
function() { return true };
';
t.equal(result[0].content, expected);
})
.done();
});
test('highlight csharp code using shortcut', function (t) {
t.plan(1);
tester.builder()
.withContent('```cs\nusing System; class Program {public static void Main(string[] args) {Console.WriteLine("Hello, world!"); } }\n```')
.withLocalPlugin(__dirname)
.withBookJson({
gitbook: pkg.engines.gitbook,
plugins: ['prism', '-highlight']
})
.create()
.then(function(result) {
var expected = 'using System; class Program {public static void Main(string[] args) {Console.WriteLine("Hello, world!"); } }
';
t.equal(result[0].content, expected);
})
.done();
});