|
| 1 | +const { |
| 2 | + deployAndRun, |
| 3 | + stepzen, |
| 4 | + getTestDescription, |
| 5 | + } = require("../../../tests/gqltest.js"); |
| 6 | + |
| 7 | + testDescription = getTestDescription("snippets", __dirname); |
| 8 | + |
| 9 | + describe(testDescription, function () { |
| 10 | + const tests = [ |
| 11 | + { label: "customer(1) return default name and city ", |
| 12 | + query: '{customer(id:1){name city }}', |
| 13 | + expected: {customer: {name:'John Doe',city:'Miami'}}, |
| 14 | + }, |
| 15 | + { label: "customer(2) with pass default state value", |
| 16 | + query: '{customer(id:2){name city state }}', |
| 17 | + expected: {customer: {name:'John Doe',city:'Miami',state:"Florida"}}, |
| 18 | + }, |
| 19 | + { label: "customer(3) xid returns null value", |
| 20 | + query: '{customer(id:2){name city state xid }}', |
| 21 | + expected: {customer: {name:'John Doe',city:'Miami',state:"Florida",xid:null}}, |
| 22 | + }, |
| 23 | + { label: "customer(4) joinDate returns const value", |
| 24 | + query: '{customer(id:2){name city joinDate }}', |
| 25 | + expected: {customer: {name:'John Doe',city:'Miami',joinDate:'2024-02-24'}}, |
| 26 | + }, |
| 27 | + { label: "customer(5) createdDate returns const value", |
| 28 | + query: '{customer(id:2){name city createdDate }}', |
| 29 | + expected: {customer: {name:'John Doe',city:'Miami',createdDate:'2024-02-24T07:20:50.52Z'}}, |
| 30 | + }, |
| 31 | + { label: "concat string", |
| 32 | + query: '{concat(a: "Steve",b:"Jobs" )}', |
| 33 | + expected: {concat: 'Steve-Jobs'}, |
| 34 | + }, |
| 35 | + { label: "JSON scalars return json_string", |
| 36 | + query: '{json_string}', |
| 37 | + expected: {"json_string": "goodbye"}, |
| 38 | + }, |
| 39 | + { label: "JSON scalars return json_list", |
| 40 | + query: '{json_list}', |
| 41 | + expected: {"json_list": [2,"hi"]}, |
| 42 | + }, |
| 43 | + { label: "return const true boolean value ", |
| 44 | + query: '{returnBoolean}', |
| 45 | + expected: {"returnBoolean": true}, |
| 46 | + }, |
| 47 | + { label: "return const integer value ", |
| 48 | + query: '{integer}', |
| 49 | + expected: {"integer": 94}, |
| 50 | + }, |
| 51 | + { label: "return const float value ", |
| 52 | + query: '{float}', |
| 53 | + expected: {"float": 241.8}, |
| 54 | + }, |
| 55 | + ] |
| 56 | + return deployAndRun(__dirname, tests, stepzen.admin); |
| 57 | + }); |
| 58 | + |
0 commit comments