|
1 | 1 | import { getUserAgentPrefix, partition, setPartitionInfo, useDefaultPartitionInfo } from "./partition";
|
2 |
| -import partitions from "./partitions.json"; |
3 | 2 |
|
4 | 3 | const MOCK_DEFAULT_PARTITION = {
|
5 | 4 | id: "aws",
|
@@ -89,32 +88,29 @@ describe("partition", () => {
|
89 | 88 | });
|
90 | 89 |
|
91 | 90 | it("should allow setting a custom partitions file", async () => {
|
92 |
| - const copy = JSON.parse(JSON.stringify(partitions)); |
| 91 | + const copy = JSON.parse( |
| 92 | + JSON.stringify({ |
| 93 | + partitions: [MOCK_DEFAULT_PARTITION, MOCK_PARTITION], |
| 94 | + }) |
| 95 | + ); |
93 | 96 | setPartitionInfo(copy);
|
94 |
| - const testRegion = "us-test-135"; |
| 97 | + const testRegion = "mock-region-12345"; |
95 | 98 | copy.partitions[0].regions[testRegion] = {
|
96 | 99 | description: "not a real region",
|
97 | 100 | };
|
98 | 101 | const result = partition(testRegion);
|
99 | 102 | expect(result).toEqual({
|
100 | 103 | description: "not a real region",
|
101 |
| - dnsSuffix: "amazonaws.com", |
102 |
| - dualStackDnsSuffix: "api.aws", |
103 | 104 | name: "aws",
|
104 |
| - supportsDualStack: true, |
105 |
| - supportsFIPS: true, |
| 105 | + dnsSuffix: "mockDefaultDnsSuffix", |
| 106 | + dualStackDnsSuffix: "mockDefaultDualStackDnsSuffix", |
| 107 | + supportsDualStack: false, |
| 108 | + supportsFIPS: false, |
106 | 109 | });
|
107 | 110 |
|
108 | 111 | useDefaultPartitionInfo();
|
109 | 112 | // result is matched by regex, but customization is no longer present.
|
110 |
| - expect(partition(testRegion)).toEqual({ |
111 |
| - description: void 0, |
112 |
| - dnsSuffix: "amazonaws.com", |
113 |
| - dualStackDnsSuffix: "api.aws", |
114 |
| - name: "aws", |
115 |
| - supportsDualStack: true, |
116 |
| - supportsFIPS: true, |
117 |
| - }); |
| 113 | + expect(partition(testRegion)["description"]).not.toBeDefined(); |
118 | 114 | });
|
119 | 115 |
|
120 | 116 | it("should optionally set a user agent prefix", async () => {
|
|
0 commit comments