@@ -39,23 +39,24 @@ const exampleMixin = {
3939 }
4040} ;
4141
42- const string = scriptToString ( object ) ;
42+ const testString = scriptToString ( object ) ;
43+ const testString2 = scriptToString ( object2 ) ;
4344const mixins = mixinsToString ( [ exampleMixin ] ) ;
4445
4546//Tests
46- const hasString = string . includes ( `string: "foo"` ) ;
47- const hasNumber = string . includes ( `number: 42` ) ;
48- const hasArray = string . includes ( `array: ["one","two","three"]` ) ;
49- const hasObject = string . includes ( `object: {dog: true,cat: false, }` ) ;
50- const hasBoolean = string . includes ( `boolean: true` ) ;
51- const hasFunction = string . includes ( `function: function _function() {
47+ const hasString = testString . includes ( `string: "foo"` ) ;
48+ const hasNumber = testString . includes ( `number: 42` ) ;
49+ const hasArray = testString . includes ( `array: ["one","two","three"]` ) ;
50+ const hasObject = testString . includes ( `object: {dog: true,cat: false}` ) ;
51+ const hasBoolean = testString . includes ( `boolean: true` ) ;
52+ const hasFunction = testString . includes ( `function: function _function() {
5253 return 'baz';
5354 }` ) ;
54- const hasDataFunc = string . includes ( `data: function(){return {"foo":"bar"}}` ) ;
55- const hasDataObj = scriptToString ( object2 ) . includes ( `data: {"foo":"bar"}` ) ;
56- const hasFinal = string === `{string: "foo",function: function _function() {
55+ const hasDataFunc = testString . includes ( `data: function(){return {"foo":"bar"}}` ) ;
56+ const hasDataObj = testString2 . includes ( `data: {"foo":"bar"}` ) ;
57+ const hasFinal = testString === `{string: "foo",function: function _function() {
5758 return 'baz';
58- },data: function(){return {"foo":"bar"}},array: ["one","two","three"],object: {dog: true,cat: false, },number: 42,boolean: true, }` ;
59+ },data: function(){return {"foo":"bar"}},array: ["one","two","three"],object: {dog: true,cat: false},number: 42,boolean: true}` ;
5960
6061test ( 'Has a String' , t => {
6162 t . is ( hasString , true ) ;
@@ -96,7 +97,7 @@ test('Has a Fully formed String', t => {
9697test ( 'Mixins' , t => {
9798 t . is ( mixins , `{methods: {hello: function hello() {
9899 console.log('Hello');
99- },}, },` ) ;
100+ }} },` ) ;
100101} ) ;
101102
102103// Test routesToString()
@@ -110,7 +111,7 @@ const routes = [
110111 { name : 'child2' , path : 'child2' , components : { childview : 'mychildcomponent2' , } , } ,
111112 ] ,
112113 } ,
113- {
114+ {
114115 path : '/route3' , component : 'mycomponent3' ,
115116 beforeEnter : function ( to , from , next ) {
116117 console . log ( to , from ) ;
@@ -122,12 +123,12 @@ const routes = [
122123const routesString = routesToString ( routes ) ;
123124const hasComponent = routesString . includes ( `component: __mycomponent3` ) ;
124125const hasChildComponent = routesString . includes ( `component: __mychildcomponent1` ) ;
125- const hasNamedViewsComponents = routesString . includes ( `components: {mainview: __mycomponent1, }` ) ;
126- const hasNamedViewsChildComponents = routesString . includes ( `components: {childview: __mychildcomponent2, }` ) ;
127- const expectedRoutesString = `[{name: "route1",path: "/route1",alias: ["asd","bsd","csd"],meta: {something: "another", },components: {mainview: __mycomponent1,}, },{path: "/route2",components: {mainview: __mycomponent2, },children: [{name: "child1",path: "child1",component: __mychildcomponent1,alias: ["xsd","ysd","zsd"], },{name: "child2",path: "child2",components: {childview: __mychildcomponent2,},},], },{path: "/route3",component: __mycomponent3,beforeEnter: function beforeEnter(to, from, next) {
126+ const hasNamedViewsComponents = routesString . includes ( `components: {mainview: __mycomponent1}` ) ;
127+ const hasNamedViewsChildComponents = routesString . includes ( `components: {childview: __mychildcomponent2}` ) ;
128+ const expectedRoutesString = `[{name: "route1",path: "/route1",alias: ["asd","bsd","csd"],meta: {something: "another"},components: {mainview: __mycomponent1} },{path: "/route2",components: {mainview: __mycomponent2},children: [{name: "child1",path: "child1",component: __mychildcomponent1,alias: ["xsd","ysd","zsd"]},{name: "child2",path: "child2",components: {childview: __mychildcomponent2}}] },{path: "/route3",component: __mycomponent3,beforeEnter: function beforeEnter(to, from, next) {
128129 console.log(to, from);
129130 next();
130- },}, ]` ;
131+ }} ]` ;
131132
132133test ( 'Has component' , t => t . is ( hasComponent , true ) ) ;
133134test ( 'Has child component' , t => t . is ( hasChildComponent , true ) ) ;
@@ -159,5 +160,5 @@ const regularScript = {
159160
160161const regularScriptString = scriptToString ( regularScript ) ;
161162test ( 'Regular script components' , ( t ) => {
162- t . is ( regularScriptString . includes ( `{component: "component",components: {prop0: "prop0",prop1: "prop1",prop2: "prop2",}, }` ) , true ) ;
163+ t . is ( regularScriptString . includes ( `{component: "component",components: {prop0: "prop0",prop1: "prop1",prop2: "prop2"} }` ) , true ) ;
163164} ) ;
0 commit comments