@@ -5,66 +5,66 @@ import sinon from 'sinon'
55
66describe ( 'yaml format - parser' , function ( ) {
77
8- const set_up = function ( { safeLoadSpyReturns , safeLoadSpyThrows } ) {
8+ const set_up = function ( { parseSpyReturns , parseSpyThrows } ) {
99 const injector = require ( 'inject-loader!./parser.js' )
10- let safeLoadSpy = sinon . stub ( ) . returns ( safeLoadSpyReturns )
11- if ( safeLoadSpyThrows )
12- safeLoadSpy = safeLoadSpy . throws ( new Error ( safeLoadSpyThrows ) )
10+ let parseSpy = sinon . stub ( ) . returns ( parseSpyReturns )
11+ if ( parseSpyThrows )
12+ parseSpy = parseSpy . throws ( new Error ( parseSpyThrows ) )
1313 const injected = injector ( {
14- 'js-yaml ' : { 'safeLoad' : safeLoadSpy } ,
14+ 'yamljs ' : { parse : parseSpy } ,
1515 } )
1616
1717 const parser = injected . default
1818 const error_message = injected . error_message
1919
20- return { parser, safeLoadSpy , error_message }
20+ return { parser, parseSpy , error_message }
2121 }
2222
2323 it ( 'should display error for empty input' , function ( ) {
24- const { parser, error_message } = set_up ( { 'safeLoadSpyReturns ' : undefined } )
24+ const { parser, error_message } = set_up ( { 'parseSpyReturns ' : undefined } )
2525 parser ( '' ) . should . deepEqual (
2626 error_message ( 'A non-empty input file is required' ) )
2727 } )
2828
2929 it ( 'should display error thrown by safeLoad' , function ( ) {
3030 const error = 'foo bar baz!'
31- const { parser, error_message } = set_up ( { 'safeLoadSpyThrows ' : error } )
31+ const { parser, error_message } = set_up ( { 'parseSpyThrows ' : error } )
3232 parser ( '' ) . should . deepEqual (
3333 error_message ( 'Error: ' + error ) )
3434 } )
3535
3636 it ( 'should not display error for valid input' , function ( ) {
37- const { parser, error_message } = set_up ( { 'safeLoadSpyReturns ' : {
37+ const { parser, error_message } = set_up ( { 'parseSpyReturns ' : {
3838 'dashboard "Hello World"' : [ ]
3939 } } )
4040 parser ( 'dashboard "Hello World": []' ) . should . not . deepEqual (
4141 error_message ( 'A non-empty input file is required' ) )
4242 } )
4343
4444 it ( 'yaml is only parsed if input is a string' , function ( ) {
45- const { parser, safeLoadSpy } = set_up ( { 'safeLoadSpyReturns ' : [ ] } )
45+ const { parser, parseSpy } = set_up ( { 'parseSpyReturns ' : [ ] } )
4646 parser ( { 'h1 text' : '' } )
47- safeLoadSpy . should . not . be . called ( )
47+ parseSpy . should . not . be . called ( )
4848 } )
4949
5050 const inputs = [ 'foo' , 'bar' ]
5151
5252 inputs . forEach ( ( arg ) =>
5353 it ( `yaml called with input - ${ arg } ` , function ( ) {
54- const { parser, safeLoadSpy } = set_up (
55- { 'safeLoadSpyReturns ' : { 'dashboard "a"' : [ ] } } )
54+ const { parser, parseSpy } = set_up (
55+ { 'parseSpyReturns ' : { 'dashboard "a"' : [ ] } } )
5656 parser ( arg )
57- safeLoadSpy . should . be . calledWith ( arg )
57+ parseSpy . should . be . calledWith ( arg )
5858 } )
5959 )
6060} )
6161
6262describe ( 'yaml format - root component' , function ( ) {
6363 const set_up = function ( ) {
6464 const injector = require ( 'inject-loader!./parser.js' )
65- const safeLoadSpy = sinon . spy ( x => x )
65+ const parseSpy = sinon . spy ( x => x )
6666 const parser = injector ( {
67- 'js-yaml ' : { 'safeLoad' : safeLoadSpy } ,
67+ 'yamljs ' : { parse : parseSpy } ,
6868 } ) . default
6969
7070 return { parser }
@@ -147,11 +147,11 @@ describe('yaml format - root component', function() {
147147
148148
149149describe ( 'yaml format - text component' , function ( ) {
150- const set_up = function ( safeLoadSpyReturns ) {
150+ const set_up = function ( parseSpyReturns ) {
151151 const injector = require ( 'inject-loader!./parser.js' )
152- const safeLoadSpy = sinon . stub ( ) . returns ( safeLoadSpyReturns )
152+ const parseSpy = sinon . stub ( ) . returns ( parseSpyReturns )
153153 const parser = injector ( {
154- 'js-yaml ' : { 'safeLoad' : safeLoadSpy } ,
154+ 'yamljs ' : { parse : parseSpy } ,
155155 } ) . default
156156
157157 return { parser }
@@ -197,9 +197,9 @@ describe('yaml format - text component', function() {
197197describe ( 'yaml format - board component' , function ( ) {
198198 const set_up = function ( ) {
199199 const injector = require ( 'inject-loader!./parser.js' )
200- const safeLoadSpy = sinon . spy ( x => x )
200+ const parseSpy = sinon . spy ( x => x )
201201 const parser = injector ( {
202- 'js-yaml ' : { 'safeLoad' : safeLoadSpy } ,
202+ 'yamljs ' : { parse : parseSpy } ,
203203 } ) . default
204204
205205 return { parser }
@@ -252,9 +252,9 @@ describe('yaml format - board component', function() {
252252describe ( 'yaml format - rows component' , function ( ) {
253253 const set_up = function ( ) {
254254 const injector = require ( 'inject-loader!./parser.js' )
255- const safeLoadSpy = sinon . spy ( x => x )
255+ const parseSpy = sinon . spy ( x => x )
256256 const parser = injector ( {
257- 'js-yaml ' : { 'safeLoad' : safeLoadSpy } ,
257+ 'yamljs ' : { parse : parseSpy } ,
258258 } ) . default
259259
260260 return { parser }
@@ -304,9 +304,9 @@ describe('yaml format - rows component', function() {
304304describe ( 'yaml format - columns component' , function ( ) {
305305 const set_up = function ( ) {
306306 const injector = require ( 'inject-loader!./parser.js' )
307- const safeLoadSpy = sinon . spy ( x => x )
307+ const parseSpy = sinon . spy ( x => x )
308308 const parser = injector ( {
309- 'js-yaml ' : { 'safeLoad' : safeLoadSpy } ,
309+ 'yamljs ' : { parse : parseSpy } ,
310310 } ) . default
311311
312312 return { parser }
@@ -383,9 +383,9 @@ describe('yaml format - columns component', function() {
383383describe ( 'yaml format - chart component' , function ( ) {
384384 const set_up = function ( ) {
385385 const injector = require ( 'inject-loader!./parser.js' )
386- const safeLoadSpy = sinon . spy ( x => x )
386+ const parseSpy = sinon . spy ( x => x )
387387 const parser = injector ( {
388- 'js-yaml ' : { 'safeLoad' : safeLoadSpy } ,
388+ 'yamljs ' : { parse : parseSpy } ,
389389 } ) . default
390390
391391 return { parser }
@@ -486,9 +486,9 @@ describe('yaml format - chart component', function() {
486486describe ( 'yaml format - handling file' , function ( ) {
487487 const set_up = function ( ) {
488488 const injector = require ( 'inject-loader!./parser.js' )
489- const safeLoadSpy = sinon . spy ( x => x )
489+ const parseSpy = sinon . spy ( x => x )
490490 const parser = injector ( {
491- 'js-yaml ' : { 'safeLoad' : safeLoadSpy } ,
491+ 'yamljs ' : { parse : parseSpy } ,
492492 } ) . default
493493
494494 return { parser }
@@ -537,9 +537,9 @@ describe('yaml format - handling file', function() {
537537describe ( 'yaml format - handling URL' , function ( ) {
538538 const set_up = function ( ) {
539539 const injector = require ( 'inject-loader!./parser.js' )
540- const safeLoadSpy = sinon . spy ( x => x )
540+ const parseSpy = sinon . spy ( x => x )
541541 const parser = injector ( {
542- 'js-yaml ' : { 'safeLoad' : safeLoadSpy } ,
542+ 'yamljs ' : { parse : parseSpy } ,
543543 } ) . default
544544
545545 return { parser }
@@ -588,9 +588,9 @@ describe('yaml format - handling URL', function() {
588588describe ( 'yaml format - attr: syntax' , function ( ) {
589589 const set_up = function ( ) {
590590 const injector = require ( 'inject-loader!./parser.js' )
591- const safeLoadSpy = sinon . spy ( x => x )
591+ const parseSpy = sinon . spy ( x => x )
592592 const parser = injector ( {
593- 'js-yaml ' : { 'safeLoad' : safeLoadSpy } ,
593+ 'yamljs ' : { parse : parseSpy } ,
594594 } ) . default
595595
596596 return { parser }
@@ -724,11 +724,11 @@ describe('integration tests', () => {
724724} )
725725
726726describe ( 'yaml format - dropdown component' , function ( ) {
727- const set_up = function ( safeLoadSpyReturns ) {
727+ const set_up = function ( parseSpyReturns ) {
728728 const injector = require ( 'inject-loader!./parser.js' )
729- const safeLoadSpy = sinon . stub ( ) . returns ( safeLoadSpyReturns )
729+ const parseSpy = sinon . stub ( ) . returns ( parseSpyReturns )
730730 const parser = injector ( {
731- 'js-yaml ' : { 'safeLoad' : safeLoadSpy } ,
731+ 'yamljs ' : { parse : parseSpy } ,
732732 } ) . default
733733
734734 return { parser }
0 commit comments