Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

stringifier.spec.ts 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. import getStringifier from '../../src/stringifier';
  2. const source = [
  3. {
  4. number: 1,
  5. source: ' /**',
  6. tokens: {
  7. start: ' ',
  8. delimiter: '/**',
  9. postDelimiter: '',
  10. tag: '',
  11. postTag: '',
  12. name: '',
  13. postName: '',
  14. type: '',
  15. postType: '',
  16. description: '',
  17. end: '',
  18. lineEnd: '',
  19. },
  20. },
  21. {
  22. number: 2,
  23. source: ' * Description may go',
  24. tokens: {
  25. start: ' ',
  26. delimiter: '*',
  27. postDelimiter: ' ',
  28. tag: '',
  29. postTag: '',
  30. name: '',
  31. postName: '',
  32. type: '',
  33. postType: '',
  34. description: 'Description may go',
  35. end: '',
  36. lineEnd: '',
  37. },
  38. },
  39. {
  40. number: 3,
  41. source: ' * over multiple lines followed by @tags',
  42. tokens: {
  43. start: ' ',
  44. delimiter: '*',
  45. postDelimiter: ' ',
  46. tag: '',
  47. postTag: '',
  48. name: '',
  49. postName: '',
  50. type: '',
  51. postType: '',
  52. description: 'over multiple lines followed by @tags',
  53. end: '',
  54. lineEnd: '',
  55. },
  56. },
  57. {
  58. number: 4,
  59. source: ' *',
  60. tokens: {
  61. start: ' ',
  62. delimiter: '*',
  63. postDelimiter: ' ',
  64. tag: '',
  65. postTag: '',
  66. name: '',
  67. postName: '',
  68. type: '',
  69. postType: '',
  70. description: '',
  71. end: '',
  72. lineEnd: '',
  73. },
  74. },
  75. {
  76. number: 5,
  77. source: '* @my-tag {my.type} my-name description line 1',
  78. tokens: {
  79. start: '',
  80. delimiter: '*',
  81. postDelimiter: ' ',
  82. tag: '@my-tag',
  83. postTag: ' ',
  84. name: 'my-name',
  85. postName: ' ',
  86. type: '{my.type}',
  87. postType: ' ',
  88. description: 'description line 1',
  89. end: '',
  90. lineEnd: '',
  91. },
  92. },
  93. {
  94. number: 6,
  95. source: ' description line 2',
  96. tokens: {
  97. start: ' ',
  98. delimiter: '',
  99. postDelimiter: '',
  100. tag: '',
  101. postTag: '',
  102. name: '',
  103. postName: '',
  104. type: '',
  105. postType: '',
  106. description: 'description line 2',
  107. end: '',
  108. lineEnd: '',
  109. },
  110. },
  111. {
  112. number: 7,
  113. source: ' * description line 3',
  114. tokens: {
  115. start: ' ',
  116. delimiter: '*',
  117. postDelimiter: ' ',
  118. tag: '',
  119. postTag: '',
  120. name: '',
  121. postName: '',
  122. type: '',
  123. postType: '',
  124. description: 'description line 3',
  125. end: '',
  126. lineEnd: '',
  127. },
  128. },
  129. {
  130. number: 8,
  131. source: ' */',
  132. tokens: {
  133. start: ' ',
  134. delimiter: '',
  135. postDelimiter: '',
  136. tag: '',
  137. postTag: '',
  138. name: '',
  139. postName: '',
  140. type: '',
  141. postType: '',
  142. description: '',
  143. end: '*/',
  144. lineEnd: '',
  145. },
  146. },
  147. ];
  148. const block = {
  149. description: '',
  150. tags: [],
  151. source,
  152. problems: [],
  153. };
  154. test('default', () => {
  155. const s = getStringifier()(block);
  156. const expected = `
  157. /**
  158. * Description may go
  159. * over multiple lines followed by @tags
  160. *
  161. * @my-tag {my.type} my-name description line 1
  162. description line 2
  163. * description line 3
  164. */`;
  165. expect(s).toBe(expected.slice(1));
  166. });