UNPKG

1.99 kBJavaScriptView Raw
1var JSDoc = require("../lib/jsdoc");
2
3
4describe('JSDoc', function() {
5 describe('stripComments', function() {
6 it('should deal with single line', function() {
7 expect( JSDoc.stripComments( '/*Mono-line*/' ) ).toBe( 'Mono-line' );
8 });
9
10 it('should deal with single line with two stars', function() {
11 expect( JSDoc.stripComments( '/** Mono-line */' ) ).toBe( 'Mono-line' );
12 });
13
14 it('should deal with MarkDown bullets', function() {
15 var result = JSDoc.stripComments(
16 "/** \n"
17 + " * Comment ça va?\n"
18 + " * Comme ci, comme ci, comme ci, comme ça.\n"
19 + " * * Red\n"
20 + " * * Green\n"
21 + " * * Blue\n"
22 + " * That's all, folks!\n"
23 + " */"
24 );
25 expect( result ).toBe(
26 "Comment ça va?\n"
27 + "Comme ci, comme ci, comme ci, comme ça.\n"
28 + "* Red\n"
29 + "* Green\n"
30 + "* Blue\n"
31 + "That's all, folks!"
32 );
33 });
34
35 it('should deal with several indentations', function() {
36 var result = JSDoc.stripComments(
37 "/** \n"
38 + " * Comment ça va?\n"
39 + " * Comme ci, comme ci, comme ci, comme ça.\n"
40 + " * * Red\n"
41 + " * * Green\n"
42 + " * * Blue\n"
43 + " * That's all, folks!\n"
44 + " */"
45 );
46 expect( result ).toBe(
47 "Comment ça va?\n"
48 + "Comme ci, comme ci, comme ci, comme ça.\n"
49 + "* Red\n"
50 + " * Green\n"
51 + " * Blue\n"
52 + "That's all, folks!"
53 );
54 });
55
56 });
57});