@@ -20,16 +20,20 @@ describe('$input.path|$input.json', function() {
2020 assert . deepEqual ( expected , actual ) ;
2121 } ) ;
2222 } ) ;
23- // https://github.com/ToQoz/api-gateway-mapping-template/blob/master/test/_.md#example-a669d28c
24- describe ( 'H=`{}` P=`a=b` ===> T=`"$input.json(\'$\')"`' , function ( ) {
25- it ( 'throw error' , function ( ) {
26- assert . throws ( function ( ) { mappingTemplate ( { template : "\"$input.json('$')\"" , payload : "a=b" } ) ; } ) ;
23+ // https://github.com/ToQoz/api-gateway-mapping-template/blob/master/test/_.md#example-0dce6fa3
24+ describe ( 'H=`{}` P=`a=b` ===> T=`$input.json(\'$\')`' , function ( ) {
25+ it ( 'return a=b' , function ( ) {
26+ var expected = "a=b" ;
27+ var actual = JSON . parse ( mappingTemplate ( { template : "$input.json('$')" , payload : "a=b" } ) ) ;
28+ assert . deepEqual ( expected , actual ) ;
2729 } ) ;
2830 } ) ;
29- // https://github.com/ToQoz/api-gateway-mapping-template/blob/master/test/_.md#example-0ce08526
30- describe ( 'H=`{}` P=`"a=b"` ===> T=`"$input.json(\'$\')"`' , function ( ) {
31- it ( 'throw error' , function ( ) {
32- assert . throws ( function ( ) { mappingTemplate ( { template : "\"$input.json('$')\"" , payload : "\"a=b\"" } ) ; } ) ;
31+ // https://github.com/ToQoz/api-gateway-mapping-template/blob/master/test/_.md#example-dbd6cf1c
32+ describe ( 'H=`{}` P=`"a=b"` ===> T=`$input.json(\'$\')`' , function ( ) {
33+ it ( 'return "a=b"' , function ( ) {
34+ var expected = "a=b" ;
35+ var actual = JSON . parse ( mappingTemplate ( { template : "$input.json('$')" , payload : "\"a=b\"" } ) ) ;
36+ assert . deepEqual ( expected , actual ) ;
3337 } ) ;
3438 } ) ;
3539 // https://github.com/ToQoz/api-gateway-mapping-template/blob/master/test/_.md#example-03be1e25
@@ -48,11 +52,11 @@ describe('$input.path|$input.json', function() {
4852 assert . deepEqual ( expected , actual ) ;
4953 } ) ;
5054 } ) ;
51- // https://github.com/ToQoz/api-gateway-mapping-template/blob/master/test/_.md#example-c1b4a9a5
52- describe ( 'H=`{}` P=`{}` ===> T=`" $input.json(\'$\')" `' , function ( ) {
55+ // https://github.com/ToQoz/api-gateway-mapping-template/blob/master/test/_.md#example-b9f18c27
56+ describe ( 'H=`{}` P=`{}` ===> T=`$input.json(\'$\')`' , function ( ) {
5357 it ( 'return {}' , function ( ) {
54- var expected = "{}" ;
55- var actual = JSON . parse ( mappingTemplate ( { template : "\" $input.json('$')\" " , payload : "{}" } ) ) ;
58+ var expected = { } ;
59+ var actual = JSON . parse ( mappingTemplate ( { template : "$input.json('$')" , payload : "{}" } ) ) ;
5660 assert . deepEqual ( expected , actual ) ;
5761 } ) ;
5862 } ) ;
0 commit comments