|
| 1 | +{ |
| 2 | + "tests": [ |
| 3 | + { |
| 4 | + "name": "w3c_is_callable_on_context", |
| 5 | + "handler": "w3c.w3c_is_callable", |
| 6 | + "request": {}, |
| 7 | + "assertions": [ |
| 8 | + { "response": { "isCallable": true } } |
| 9 | + ] |
| 10 | + }, |
| 11 | + |
| 12 | + { |
| 13 | + "name": "w3c_returns_empty_when_no_client_context_header", |
| 14 | + "handler": "w3c.get_w3c", |
| 15 | + "request": {}, |
| 16 | + "assertions": [ |
| 17 | + { "response": {} } |
| 18 | + ] |
| 19 | + }, |
| 20 | + |
| 21 | + { |
| 22 | + "name": "w3c_returns_empty_when_client_context_has_no_w3c_key", |
| 23 | + "handler": "w3c.get_w3c", |
| 24 | + "request": {}, |
| 25 | + "clientContext": { |
| 26 | + "custom": { "value": "test" } |
| 27 | + }, |
| 28 | + "assertions": [ |
| 29 | + { "response": {} } |
| 30 | + ] |
| 31 | + }, |
| 32 | + |
| 33 | + { |
| 34 | + "name": "w3c_returns_baggage_only", |
| 35 | + "handler": "w3c.get_w3c", |
| 36 | + "request": {}, |
| 37 | + "clientContext": { |
| 38 | + "w3c": { "baggage": "userId=alice" } |
| 39 | + }, |
| 40 | + "assertions": [ |
| 41 | + { "response": { "baggage": "userId=alice" } } |
| 42 | + ] |
| 43 | + }, |
| 44 | + |
| 45 | + { |
| 46 | + "name": "w3c_returns_all_three_allowlisted_fields", |
| 47 | + "handler": "w3c.get_w3c", |
| 48 | + "request": {}, |
| 49 | + "clientContext": { |
| 50 | + "w3c": { |
| 51 | + "traceparent": "00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01", |
| 52 | + "tracestate": "rojo=00f067aa0ba902b7", |
| 53 | + "baggage": "userId=alice" |
| 54 | + } |
| 55 | + }, |
| 56 | + "assertions": [ |
| 57 | + { |
| 58 | + "response": { |
| 59 | + "traceparent": "00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01", |
| 60 | + "tracestate": "rojo=00f067aa0ba902b7", |
| 61 | + "baggage": "userId=alice" |
| 62 | + } |
| 63 | + } |
| 64 | + ] |
| 65 | + }, |
| 66 | + |
| 67 | + { |
| 68 | + "name": "w3c_allowlist_drops_non_allowlisted_keys", |
| 69 | + "handler": "w3c.get_w3c", |
| 70 | + "request": {}, |
| 71 | + "clientContext": { |
| 72 | + "w3c": { |
| 73 | + "baggage": "keep=me", |
| 74 | + "unknownField": "should-not-appear", |
| 75 | + "x-custom-trace": "should-not-appear" |
| 76 | + } |
| 77 | + }, |
| 78 | + "assertions": [ |
| 79 | + { "response": { "baggage": "keep=me" } } |
| 80 | + ] |
| 81 | + }, |
| 82 | + |
| 83 | + { |
| 84 | + "name": "w3c_drops_allowlisted_fields_with_non_string_values", |
| 85 | + "handler": "w3c.get_w3c", |
| 86 | + "request": {}, |
| 87 | + "clientContext": { |
| 88 | + "w3c": { |
| 89 | + "traceparent": 42, |
| 90 | + "tracestate": null, |
| 91 | + "baggage": { "nested": "no" } |
| 92 | + } |
| 93 | + }, |
| 94 | + "assertions": [ |
| 95 | + { "response": {} } |
| 96 | + ] |
| 97 | + }, |
| 98 | + |
| 99 | + { |
| 100 | + "name": "w3c_treats_non_object_as_empty", |
| 101 | + "handler": "w3c.get_w3c", |
| 102 | + "request": {}, |
| 103 | + "clientContext": { |
| 104 | + "w3c": "not-an-object" |
| 105 | + }, |
| 106 | + "assertions": [ |
| 107 | + { "response": {} } |
| 108 | + ] |
| 109 | + }, |
| 110 | + |
| 111 | + { |
| 112 | + "name": "w3c_treats_array_as_empty", |
| 113 | + "handler": "w3c.get_w3c", |
| 114 | + "request": {}, |
| 115 | + "clientContext": { |
| 116 | + "w3c": ["baggage=abc"] |
| 117 | + }, |
| 118 | + "assertions": [ |
| 119 | + { "response": {} } |
| 120 | + ] |
| 121 | + }, |
| 122 | + |
| 123 | + { |
| 124 | + "name": "w3c_strips_source_client_context_w3c_after_construction", |
| 125 | + "handler": "w3c.get_w3c_and_source", |
| 126 | + "request": {}, |
| 127 | + "clientContext": { |
| 128 | + "custom": { "value": "test" }, |
| 129 | + "w3c": { |
| 130 | + "traceparent": "00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01", |
| 131 | + "baggage": "userId=alice" |
| 132 | + } |
| 133 | + }, |
| 134 | + "assertions": [ |
| 135 | + { |
| 136 | + "response": { |
| 137 | + "w3c": { |
| 138 | + "traceparent": "00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01", |
| 139 | + "baggage": "userId=alice" |
| 140 | + }, |
| 141 | + "clientContextIsDefined": true, |
| 142 | + "clientContextHasW3c": false, |
| 143 | + "clientContext": { "custom": { "value": "test" } } |
| 144 | + } |
| 145 | + } |
| 146 | + ] |
| 147 | + } |
| 148 | + ] |
| 149 | +} |
0 commit comments