|
| 1 | +// Jest Snapshot v1, https://goo.gl/fbAQLP |
| 2 | + |
| 3 | +exports[`getAppSyncConfig should generate a valid config 1`] = ` |
| 4 | +Object { |
| 5 | + "additionalAuthenticationProviders": Array [], |
| 6 | + "apiKey": "123456789", |
| 7 | + "defaultAuthenticationType": Object { |
| 8 | + "authenticationType": "API_KEY", |
| 9 | + }, |
| 10 | + "name": "myAPI", |
| 11 | +} |
| 12 | +`; |
| 13 | + |
| 14 | +exports[`getAppSyncConfig should generate a valid config 2`] = ` |
| 15 | +Object { |
| 16 | + "content": "type Post { |
| 17 | + userId: Int! |
| 18 | + id: Int! |
| 19 | + title: String! |
| 20 | + body: String! |
| 21 | +} |
| 22 | +
|
| 23 | +type Query { |
| 24 | + getPost: Post |
| 25 | + getPosts: [Post]! |
| 26 | +} |
| 27 | +
|
| 28 | +schema { |
| 29 | + query: Query |
| 30 | +} |
| 31 | +", |
| 32 | + "path": "schema.graphql", |
| 33 | +} |
| 34 | +`; |
| 35 | + |
| 36 | +exports[`getAppSyncConfig should generate a valid config 3`] = ` |
| 37 | +Array [ |
| 38 | + Object { |
| 39 | + "dataSourceName": "lambda", |
| 40 | + "fieldName": "templates", |
| 41 | + "functions": undefined, |
| 42 | + "kind": "UNIT", |
| 43 | + "requestMappingTemplate": "{ |
| 44 | + \\"version\\": \\"2018-05-29\\", |
| 45 | + \\"operation\\": \\"Invoke\\", |
| 46 | + \\"payload\\": { |
| 47 | + \\"substitution\\": \\"lambda\\", |
| 48 | + \\"args\\": $utils.toJson($context.arguments) |
| 49 | + } |
| 50 | +} |
| 51 | +", |
| 52 | + "responseMappingTemplate": "$utils.toJson($context.result.lambda) |
| 53 | +", |
| 54 | + "typeName": "Query", |
| 55 | + }, |
| 56 | + Object { |
| 57 | + "dataSourceName": "lambda", |
| 58 | + "fieldName": "default", |
| 59 | + "functions": undefined, |
| 60 | + "kind": "UNIT", |
| 61 | + "requestMappingTemplate": "{ |
| 62 | + \\"version\\": \\"2018-05-29\\", |
| 63 | + \\"operation\\": \\"Invoke\\", |
| 64 | + \\"payload\\": { |
| 65 | + \\"substitution\\": \\"default\\", |
| 66 | + \\"type\\": \\"default\\" |
| 67 | + } |
| 68 | +} |
| 69 | +", |
| 70 | + "responseMappingTemplate": "$utils.toJson($context.result.default) |
| 71 | +", |
| 72 | + "typeName": "Query", |
| 73 | + }, |
| 74 | + Object { |
| 75 | + "dataSourceName": "lambda", |
| 76 | + "fieldName": "directLambda", |
| 77 | + "functions": undefined, |
| 78 | + "kind": "UNIT", |
| 79 | + "requestMappingTemplate": "## Direct lambda request |
| 80 | +{ |
| 81 | + \\"version\\": \\"2018-05-29\\", |
| 82 | + \\"operation\\": \\"Invoke\\", |
| 83 | + \\"payload\\": $utils.toJson($context) |
| 84 | +} |
| 85 | +", |
| 86 | + "responseMappingTemplate": "## Direct lambda response |
| 87 | +#if($ctx.error) |
| 88 | + $util.error($ctx.error.message, $ctx.error.type, $ctx.result) |
| 89 | +#end |
| 90 | +$util.toJson($ctx.result) |
| 91 | +", |
| 92 | + "typeName": "Query", |
| 93 | + }, |
| 94 | + Object { |
| 95 | + "dataSourceName": undefined, |
| 96 | + "fieldName": "pipeline", |
| 97 | + "functions": Array [ |
| 98 | + "func", |
| 99 | + "func-default", |
| 100 | + ], |
| 101 | + "kind": "PIPELINE", |
| 102 | + "requestMappingTemplate": "{ |
| 103 | + \\"version\\": \\"2018-05-29\\", |
| 104 | + \\"operation\\": \\"Invoke\\", |
| 105 | + \\"payload\\": { |
| 106 | + \\"substitution\\": \\"pipeline\\", |
| 107 | + \\"type\\": \\"default\\" |
| 108 | + } |
| 109 | +} |
| 110 | +", |
| 111 | + "responseMappingTemplate": "$utils.toJson($context.result.default) |
| 112 | +", |
| 113 | + "typeName": "Query", |
| 114 | + }, |
| 115 | +] |
| 116 | +`; |
| 117 | + |
| 118 | +exports[`getAppSyncConfig should generate a valid config 4`] = ` |
| 119 | +Array [ |
| 120 | + Object { |
| 121 | + "invoke": [Function], |
| 122 | + "name": "lambda", |
| 123 | + "type": "AWS_LAMBDA", |
| 124 | + }, |
| 125 | + Object { |
| 126 | + "config": Object { |
| 127 | + "accessKeyId": "DEFAULT_ACCESS_KEY", |
| 128 | + "endpoint": "http://localhost:8000", |
| 129 | + "region": "localhost", |
| 130 | + "secretAccessKey": "DEFAULT_SECRET", |
| 131 | + "tableName": "myTable", |
| 132 | + }, |
| 133 | + "name": "dynamodb", |
| 134 | + "type": "AMAZON_DYNAMODB", |
| 135 | + }, |
| 136 | + Object { |
| 137 | + "endpoint": "http://127.0.0.1", |
| 138 | + "name": "http", |
| 139 | + "type": "HTTP", |
| 140 | + }, |
| 141 | +] |
| 142 | +`; |
| 143 | + |
| 144 | +exports[`getAppSyncConfig should generate a valid config 5`] = ` |
| 145 | +Array [ |
| 146 | + Object { |
| 147 | + "dataSourceName": "lambda", |
| 148 | + "name": "func", |
| 149 | + "requestMappingTemplate": "{ |
| 150 | + \\"version\\": \\"2018-05-29\\", |
| 151 | + \\"operation\\": \\"Invoke\\", |
| 152 | + \\"payload\\": { |
| 153 | + \\"substitution\\": \\"template-function\\", |
| 154 | + \\"args\\": $utils.toJson($context.arguments) |
| 155 | + } |
| 156 | +} |
| 157 | +", |
| 158 | + "responseMappingTemplate": "$utils.toJson($context.result.lambda) |
| 159 | +", |
| 160 | + }, |
| 161 | + Object { |
| 162 | + "dataSourceName": "lambda", |
| 163 | + "name": "func-default", |
| 164 | + "requestMappingTemplate": "{ |
| 165 | + \\"version\\": \\"2018-05-29\\", |
| 166 | + \\"operation\\": \\"Invoke\\", |
| 167 | + \\"payload\\": { |
| 168 | + \\"substitution\\": \\"default-function\\", |
| 169 | + \\"type\\": \\"default\\" |
| 170 | + } |
| 171 | +} |
| 172 | +", |
| 173 | + "responseMappingTemplate": "$utils.toJson($context.result.default) |
| 174 | +", |
| 175 | + }, |
| 176 | + Object { |
| 177 | + "dataSourceName": "lambda", |
| 178 | + "name": "func-direct", |
| 179 | + "requestMappingTemplate": "## Direct lambda request |
| 180 | +{ |
| 181 | + \\"version\\": \\"2018-05-29\\", |
| 182 | + \\"operation\\": \\"Invoke\\", |
| 183 | + \\"payload\\": $utils.toJson($context) |
| 184 | +} |
| 185 | +", |
| 186 | + "responseMappingTemplate": "## Direct lambda response |
| 187 | +#if($ctx.error) |
| 188 | + $util.error($ctx.error.message, $ctx.error.type, $ctx.result) |
| 189 | +#end |
| 190 | +$util.toJson($ctx.result) |
| 191 | +", |
| 192 | + }, |
| 193 | +] |
| 194 | +`; |
0 commit comments