1*46dc8e76SBartosz Kaszubowskiimport { cleanCopyValue } from './code'; 2*46dc8e76SBartosz Kaszubowski 3*46dc8e76SBartosz Kaszubowskidescribe('cleanCopyValue', () => { 4*46dc8e76SBartosz Kaszubowski it('SlashComments - preserves the fully annotated line', () => { 5*46dc8e76SBartosz Kaszubowski expect( 6*46dc8e76SBartosz Kaszubowski cleanCopyValue( 7*46dc8e76SBartosz Kaszubowski `/* @info Import FontAwesome. */import FontAwesome from "@expo/vector-icons/FontAwesome";/* @end */` 8*46dc8e76SBartosz Kaszubowski ) 9*46dc8e76SBartosz Kaszubowski ).toBe(`import FontAwesome from "@expo/vector-icons/FontAwesome";`); 10*46dc8e76SBartosz Kaszubowski }); 11*46dc8e76SBartosz Kaszubowski 12*46dc8e76SBartosz Kaszubowski it('SlashComments - removes the annotation mid-line', () => { 13*46dc8e76SBartosz Kaszubowski expect( 14*46dc8e76SBartosz Kaszubowski cleanCopyValue( 15*46dc8e76SBartosz Kaszubowski `export default function Button({ label,/* @info The prop theme to detect the button variant. */ theme/* @end */ }) {` 16*46dc8e76SBartosz Kaszubowski ) 17*46dc8e76SBartosz Kaszubowski ).toBe(`export default function Button({ label, theme }) {`); 18*46dc8e76SBartosz Kaszubowski }); 19*46dc8e76SBartosz Kaszubowski 20*46dc8e76SBartosz Kaszubowski it('SlashComments - preserves the line wrapped with annotations', () => { 21*46dc8e76SBartosz Kaszubowski expect( 22*46dc8e76SBartosz Kaszubowski cleanCopyValue( 23*46dc8e76SBartosz Kaszubowski ` /* @info This text will be shown onHover */ 24*46dc8e76SBartosz Kaszubowski return x + 1; 25*46dc8e76SBartosz Kaszubowski /* @end */` 26*46dc8e76SBartosz Kaszubowski ) 27*46dc8e76SBartosz Kaszubowski ).toBe(` return x + 1;`); 28*46dc8e76SBartosz Kaszubowski }); 29*46dc8e76SBartosz Kaszubowski 30*46dc8e76SBartosz Kaszubowski it('SlashComments - removes @hide line', () => { 31*46dc8e76SBartosz Kaszubowski expect( 32*46dc8e76SBartosz Kaszubowski cleanCopyValue(`const styles = StyleSheet.create({ 33*46dc8e76SBartosz Kaszubowski /* @hide // Styles that are unchanged from previous step are hidden for brevity. */ 34*46dc8e76SBartosz Kaszubowski container: {`) 35*46dc8e76SBartosz Kaszubowski ).toBe(`const styles = StyleSheet.create({ 36*46dc8e76SBartosz Kaszubowski container: {`); 37*46dc8e76SBartosz Kaszubowski }); 38*46dc8e76SBartosz Kaszubowski 39*46dc8e76SBartosz Kaszubowski it('SlashComments - removes annotation with # in content', () => { 40*46dc8e76SBartosz Kaszubowski expect( 41*46dc8e76SBartosz Kaszubowski cleanCopyValue(` /* @info Replace the default value of backgroundColor property with '#25292e'. */ 42*46dc8e76SBartosz Kaszubowski backgroundColor: '#25292e', 43*46dc8e76SBartosz Kaszubowski /* @end */`) 44*46dc8e76SBartosz Kaszubowski ).toBe(` backgroundColor: '#25292e',`); 45*46dc8e76SBartosz Kaszubowski }); 46*46dc8e76SBartosz Kaszubowski 47*46dc8e76SBartosz Kaszubowski it('HashComments - preserves the fully annotated line', () => { 48*46dc8e76SBartosz Kaszubowski expect( 49*46dc8e76SBartosz Kaszubowski cleanCopyValue( 50*46dc8e76SBartosz Kaszubowski `# @info Import FontAwesome. #import FontAwesome from "@expo/vector-icons/FontAwesome";# @end #` 51*46dc8e76SBartosz Kaszubowski ) 52*46dc8e76SBartosz Kaszubowski ).toBe(`import FontAwesome from "@expo/vector-icons/FontAwesome";`); 53*46dc8e76SBartosz Kaszubowski }); 54*46dc8e76SBartosz Kaszubowski 55*46dc8e76SBartosz Kaszubowski it('HashComments - removes the annotation mid-line', () => { 56*46dc8e76SBartosz Kaszubowski expect( 57*46dc8e76SBartosz Kaszubowski cleanCopyValue( 58*46dc8e76SBartosz Kaszubowski `export default function Button({ label,# @info The prop theme to detect the button variant. # theme# @end # }) {` 59*46dc8e76SBartosz Kaszubowski ) 60*46dc8e76SBartosz Kaszubowski ).toBe(`export default function Button({ label, theme }) {`); 61*46dc8e76SBartosz Kaszubowski }); 62*46dc8e76SBartosz Kaszubowski 63*46dc8e76SBartosz Kaszubowski it('HashComments - preserves the line wrapped with annotations', () => { 64*46dc8e76SBartosz Kaszubowski expect( 65*46dc8e76SBartosz Kaszubowski cleanCopyValue( 66*46dc8e76SBartosz Kaszubowski ` # @info This text will be shown onHover # 67*46dc8e76SBartosz Kaszubowski return x + 1; 68*46dc8e76SBartosz Kaszubowski # @end #` 69*46dc8e76SBartosz Kaszubowski ) 70*46dc8e76SBartosz Kaszubowski ).toBe(` return x + 1;`); 71*46dc8e76SBartosz Kaszubowski }); 72*46dc8e76SBartosz Kaszubowski 73*46dc8e76SBartosz Kaszubowski it('HashComments - removes @hide line', () => { 74*46dc8e76SBartosz Kaszubowski expect( 75*46dc8e76SBartosz Kaszubowski cleanCopyValue(`const styles = StyleSheet.create({ 76*46dc8e76SBartosz Kaszubowski # @hide // Styles that are unchanged from previous step are hidden for brevity. # 77*46dc8e76SBartosz Kaszubowski container: {`) 78*46dc8e76SBartosz Kaszubowski ).toBe(`const styles = StyleSheet.create({ 79*46dc8e76SBartosz Kaszubowski container: {`); 80*46dc8e76SBartosz Kaszubowski }); 81*46dc8e76SBartosz Kaszubowski 82*46dc8e76SBartosz Kaszubowski it('XMLComments - preserves the fully annotated line', () => { 83*46dc8e76SBartosz Kaszubowski expect( 84*46dc8e76SBartosz Kaszubowski cleanCopyValue( 85*46dc8e76SBartosz Kaszubowski `<!-- @info Import FontAwesome. -->import FontAwesome from "@expo/vector-icons/FontAwesome";<!-- @end -->` 86*46dc8e76SBartosz Kaszubowski ) 87*46dc8e76SBartosz Kaszubowski ).toBe(`import FontAwesome from "@expo/vector-icons/FontAwesome";`); 88*46dc8e76SBartosz Kaszubowski }); 89*46dc8e76SBartosz Kaszubowski 90*46dc8e76SBartosz Kaszubowski it('XMLComments - removes the annotation mid-line', () => { 91*46dc8e76SBartosz Kaszubowski expect( 92*46dc8e76SBartosz Kaszubowski cleanCopyValue( 93*46dc8e76SBartosz Kaszubowski `export default function Button({ label,<!-- @info The prop theme to detect the button variant. --> theme<!-- @end --> }) {` 94*46dc8e76SBartosz Kaszubowski ) 95*46dc8e76SBartosz Kaszubowski ).toBe(`export default function Button({ label, theme }) {`); 96*46dc8e76SBartosz Kaszubowski }); 97*46dc8e76SBartosz Kaszubowski 98*46dc8e76SBartosz Kaszubowski it('XMLComments - preserves the line wrapped with annotations', () => { 99*46dc8e76SBartosz Kaszubowski expect( 100*46dc8e76SBartosz Kaszubowski cleanCopyValue( 101*46dc8e76SBartosz Kaszubowski ` <!-- @info This text will be shown onHover --> 102*46dc8e76SBartosz Kaszubowski return x + 1; 103*46dc8e76SBartosz Kaszubowski <!-- @end -->` 104*46dc8e76SBartosz Kaszubowski ) 105*46dc8e76SBartosz Kaszubowski ).toBe(` return x + 1;`); 106*46dc8e76SBartosz Kaszubowski }); 107*46dc8e76SBartosz Kaszubowski 108*46dc8e76SBartosz Kaszubowski it('XMLComments - removes @hide line', () => { 109*46dc8e76SBartosz Kaszubowski expect( 110*46dc8e76SBartosz Kaszubowski cleanCopyValue(`const styles = StyleSheet.create({ 111*46dc8e76SBartosz Kaszubowski <!-- @hide // Styles that are unchanged from previous step are hidden for brevity. --> 112*46dc8e76SBartosz Kaszubowski container: {`) 113*46dc8e76SBartosz Kaszubowski ).toBe(`const styles = StyleSheet.create({ 114*46dc8e76SBartosz Kaszubowski container: {`); 115*46dc8e76SBartosz Kaszubowski }); 116*46dc8e76SBartosz Kaszubowski}); 117