@fgv/ts-web-extras 5.1.0-1 → 5.1.0-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/.rush/temp/chunked-rush-logs/ts-web-extras.build.chunks.jsonl +26 -26
  2. package/.rush/temp/chunked-rush-logs/ts-web-extras.test.chunks.jsonl +47 -42
  3. package/.rush/temp/operation/build/all.log +26 -26
  4. package/.rush/temp/operation/build/error.log +9 -9
  5. package/.rush/temp/operation/build/log-chunks.jsonl +26 -26
  6. package/.rush/temp/operation/build/state.json +1 -1
  7. package/.rush/temp/operation/test/all.log +47 -42
  8. package/.rush/temp/operation/test/error.log +10 -8
  9. package/.rush/temp/operation/test/log-chunks.jsonl +47 -42
  10. package/.rush/temp/operation/test/state.json +1 -1
  11. package/dist/packlets/file-tree/httpTreeAccessors.js +68 -11
  12. package/dist/packlets/file-tree/httpTreeAccessors.js.map +1 -1
  13. package/dist/test/unit/httpTreeAccessors.test.js +303 -74
  14. package/dist/test/unit/httpTreeAccessors.test.js.map +1 -1
  15. package/dist/ts-web-extras.d.ts +14 -0
  16. package/lib/packlets/file-tree/httpTreeAccessors.d.ts +14 -0
  17. package/lib/packlets/file-tree/httpTreeAccessors.d.ts.map +1 -1
  18. package/lib/packlets/file-tree/httpTreeAccessors.js +68 -11
  19. package/lib/packlets/file-tree/httpTreeAccessors.js.map +1 -1
  20. package/lib/test/unit/httpTreeAccessors.test.js +303 -74
  21. package/lib/test/unit/httpTreeAccessors.test.js.map +1 -1
  22. package/package.json +1 -1
  23. package/rush-logs/ts-web-extras.build.error.log +9 -9
  24. package/rush-logs/ts-web-extras.build.log +26 -26
  25. package/rush-logs/ts-web-extras.test.error.log +10 -8
  26. package/rush-logs/ts-web-extras.test.log +47 -42
  27. package/src/packlets/file-tree/httpTreeAccessors.ts +79 -12
  28. package/src/test/unit/httpTreeAccessors.test.ts +377 -84
  29. package/temp/build/typescript/ts_8nwakTlr.json +1 -1
  30. package/temp/coverage/crypto-utils/browserCryptoProvider.ts.html +1 -1
  31. package/temp/coverage/crypto-utils/browserHashProvider.ts.html +1 -1
  32. package/temp/coverage/crypto-utils/index.html +1 -1
  33. package/temp/coverage/file-tree/directoryHandleStore.ts.html +1 -1
  34. package/temp/coverage/file-tree/fileApiTreeAccessors.ts.html +1 -1
  35. package/temp/coverage/file-tree/fileSystemAccessTreeAccessors.ts.html +1 -1
  36. package/temp/coverage/file-tree/httpTreeAccessors.ts.html +369 -168
  37. package/temp/coverage/file-tree/index.html +11 -11
  38. package/temp/coverage/file-tree/localStorageTreeAccessors.ts.html +1 -1
  39. package/temp/coverage/helpers/fileTreeHelpers.ts.html +1 -1
  40. package/temp/coverage/helpers/index.html +1 -1
  41. package/temp/coverage/index.html +11 -11
  42. package/temp/coverage/lcov-report/crypto-utils/browserCryptoProvider.ts.html +1 -1
  43. package/temp/coverage/lcov-report/crypto-utils/browserHashProvider.ts.html +1 -1
  44. package/temp/coverage/lcov-report/crypto-utils/index.html +1 -1
  45. package/temp/coverage/lcov-report/file-tree/directoryHandleStore.ts.html +1 -1
  46. package/temp/coverage/lcov-report/file-tree/fileApiTreeAccessors.ts.html +1 -1
  47. package/temp/coverage/lcov-report/file-tree/fileSystemAccessTreeAccessors.ts.html +1 -1
  48. package/temp/coverage/lcov-report/file-tree/httpTreeAccessors.ts.html +369 -168
  49. package/temp/coverage/lcov-report/file-tree/index.html +11 -11
  50. package/temp/coverage/lcov-report/file-tree/localStorageTreeAccessors.ts.html +1 -1
  51. package/temp/coverage/lcov-report/helpers/fileTreeHelpers.ts.html +1 -1
  52. package/temp/coverage/lcov-report/helpers/index.html +1 -1
  53. package/temp/coverage/lcov-report/index.html +11 -11
  54. package/temp/coverage/lcov-report/url-utils/index.html +1 -1
  55. package/temp/coverage/lcov-report/url-utils/urlParams.ts.html +1 -1
  56. package/temp/coverage/lcov.info +479 -379
  57. package/temp/coverage/url-utils/index.html +1 -1
  58. package/temp/coverage/url-utils/urlParams.ts.html +1 -1
  59. package/temp/test/jest/haste-map-b931e4e63102f86c5bd4949f7dced44f-9d713eb41149188b4e5c0ae3d86d0a57-2ad8e16b24e391b8cdbe50b55c137169 +0 -0
  60. package/temp/test/jest/perf-cache-b931e4e63102f86c5bd4949f7dced44f-da39a3ee5e6b4b0d3255bfef95601890 +1 -1
  61. package/temp/ts-web-extras.api.json +1 -1
@@ -29,6 +29,7 @@ function makeMockResponse(options) {
29
29
  return {
30
30
  ok,
31
31
  status,
32
+ statusText: ok ? 'OK' : `Error ${status}`,
32
33
  json: throwOnJson
33
34
  ? () => Promise.reject(new Error('JSON parse error'))
34
35
  : () => Promise.resolve(jsonValue),
@@ -597,65 +598,99 @@ describe('HttpTreeAccessors', () => {
597
598
  expect(result).toFailWith(/sync.*data\.json.*server error/i);
598
599
  });
599
600
  test('fails when PUT for a dirty file encounters a network error', async () => {
600
- let callCount = 0;
601
- const fetchImpl = (_url, _init) => {
602
- callCount++;
603
- if (callCount === 1) {
604
- return Promise.resolve(makeMockResponse({ ok: true, jsonValue: rootWithOneFile('data.json') }));
605
- }
606
- if (callCount === 2) {
607
- return Promise.resolve(makeMockResponse({ ok: true, jsonValue: fileResponse('/data.json', '{}') }));
608
- }
609
- return Promise.reject(new Error('PUT network error'));
610
- };
611
- const accessors = (await file_tree_1.HttpTreeAccessors.fromHttp({
612
- baseUrl: 'http://localhost:3000',
613
- fetchImpl,
614
- mutable: true
615
- })).orThrow();
616
- accessors.saveFileContents('/data.json', '"updated"').orThrow();
617
- const result = await accessors.syncToDisk();
618
- expect(result).toFailWith(/put network error/i);
601
+ jest.useFakeTimers();
602
+ try {
603
+ let callCount = 0;
604
+ const fetchImpl = (_url, _init) => {
605
+ callCount++;
606
+ if (callCount === 1) {
607
+ return Promise.resolve(makeMockResponse({ ok: true, jsonValue: rootWithOneFile('data.json') }));
608
+ }
609
+ if (callCount === 2) {
610
+ return Promise.resolve(makeMockResponse({ ok: true, jsonValue: fileResponse('/data.json', '{}') }));
611
+ }
612
+ return Promise.reject(new Error('PUT network error'));
613
+ };
614
+ const accessors = (await file_tree_1.HttpTreeAccessors.fromHttp({
615
+ baseUrl: 'http://localhost:3000',
616
+ fetchImpl,
617
+ mutable: true
618
+ })).orThrow();
619
+ accessors.saveFileContents('/data.json', '"updated"').orThrow();
620
+ const syncPromise = accessors.syncToDisk();
621
+ await jest.advanceTimersByTimeAsync(1500);
622
+ const result = await syncPromise;
623
+ expect(result).toFailWith(/put network error/i);
624
+ }
625
+ finally {
626
+ jest.useRealTimers();
627
+ }
619
628
  });
620
629
  test('fails when POST /sync returns a non-ok response', async () => {
621
- const { fetchImpl } = makeMockFetch([
622
- { ok: true, jsonValue: rootWithOneFile('data.json') },
623
- { ok: true, jsonValue: fileResponse('/data.json', '{}') },
624
- { ok: true, jsonValue: fileResponse('/data.json', '"v2"') },
625
- { ok: false, status: 503, textValue: 'Service Unavailable' }
626
- ]);
627
- const accessors = (await file_tree_1.HttpTreeAccessors.fromHttp({
628
- baseUrl: 'http://localhost:3000',
629
- fetchImpl,
630
- mutable: true
631
- })).orThrow();
632
- accessors.saveFileContents('/data.json', '"v2"').orThrow();
633
- const result = await accessors.syncToDisk();
634
- expect(result).toFailWith(/service unavailable/i);
630
+ jest.useFakeTimers();
631
+ try {
632
+ let callCount = 0;
633
+ const fetchImpl = (_url, _init) => {
634
+ callCount++;
635
+ if (callCount === 1) {
636
+ return Promise.resolve(makeMockResponse({ ok: true, jsonValue: rootWithOneFile('data.json') }));
637
+ }
638
+ if (callCount === 2) {
639
+ return Promise.resolve(makeMockResponse({ ok: true, jsonValue: fileResponse('/data.json', '{}') }));
640
+ }
641
+ if (callCount === 3) {
642
+ return Promise.resolve(makeMockResponse({ ok: true, jsonValue: fileResponse('/data.json', '"v2"') }));
643
+ }
644
+ // All /sync attempts: persistent 503
645
+ return Promise.resolve(makeMockResponse({ ok: false, status: 503, textValue: 'Service Unavailable' }));
646
+ };
647
+ const accessors = (await file_tree_1.HttpTreeAccessors.fromHttp({
648
+ baseUrl: 'http://localhost:3000',
649
+ fetchImpl,
650
+ mutable: true
651
+ })).orThrow();
652
+ accessors.saveFileContents('/data.json', '"v2"').orThrow();
653
+ const syncPromise = accessors.syncToDisk();
654
+ // Advance past both backoff delays: 500ms + 1000ms
655
+ await jest.advanceTimersByTimeAsync(1500);
656
+ const result = await syncPromise;
657
+ expect(result).toFailWith(/service unavailable/i);
658
+ }
659
+ finally {
660
+ jest.useRealTimers();
661
+ }
635
662
  });
636
663
  test('fails when POST /sync encounters a network error', async () => {
637
- let callCount = 0;
638
- const fetchImpl = (_url, _init) => {
639
- callCount++;
640
- if (callCount === 1) {
641
- return Promise.resolve(makeMockResponse({ ok: true, jsonValue: rootWithOneFile('data.json') }));
642
- }
643
- if (callCount === 2) {
644
- return Promise.resolve(makeMockResponse({ ok: true, jsonValue: fileResponse('/data.json', '{}') }));
645
- }
646
- if (callCount === 3) {
647
- return Promise.resolve(makeMockResponse({ ok: true, jsonValue: fileResponse('/data.json', '"v2"') }));
648
- }
649
- return Promise.reject(new Error('POST network error'));
650
- };
651
- const accessors = (await file_tree_1.HttpTreeAccessors.fromHttp({
652
- baseUrl: 'http://localhost:3000',
653
- fetchImpl,
654
- mutable: true
655
- })).orThrow();
656
- accessors.saveFileContents('/data.json', '"v2"').orThrow();
657
- const result = await accessors.syncToDisk();
658
- expect(result).toFailWith(/post network error/i);
664
+ jest.useFakeTimers();
665
+ try {
666
+ let callCount = 0;
667
+ const fetchImpl = (_url, _init) => {
668
+ callCount++;
669
+ if (callCount === 1) {
670
+ return Promise.resolve(makeMockResponse({ ok: true, jsonValue: rootWithOneFile('data.json') }));
671
+ }
672
+ if (callCount === 2) {
673
+ return Promise.resolve(makeMockResponse({ ok: true, jsonValue: fileResponse('/data.json', '{}') }));
674
+ }
675
+ if (callCount === 3) {
676
+ return Promise.resolve(makeMockResponse({ ok: true, jsonValue: fileResponse('/data.json', '"v2"') }));
677
+ }
678
+ return Promise.reject(new Error('POST network error'));
679
+ };
680
+ const accessors = (await file_tree_1.HttpTreeAccessors.fromHttp({
681
+ baseUrl: 'http://localhost:3000',
682
+ fetchImpl,
683
+ mutable: true
684
+ })).orThrow();
685
+ accessors.saveFileContents('/data.json', '"v2"').orThrow();
686
+ const syncPromise = accessors.syncToDisk();
687
+ await jest.advanceTimersByTimeAsync(1500);
688
+ const result = await syncPromise;
689
+ expect(result).toFailWith(/post network error/i);
690
+ }
691
+ finally {
692
+ jest.useRealTimers();
693
+ }
659
694
  });
660
695
  test('syncs multiple dirty files in order', async () => {
661
696
  const { fetchImpl, calls } = makeMockFetch([
@@ -848,25 +883,34 @@ describe('HttpTreeAccessors', () => {
848
883
  });
849
884
  test('returns failure with HTTP status fallback when response.text() throws during sync', async () => {
850
885
  // Covers the text() catch branch in _request(): uses `HTTP ${status}` fallback
851
- let callCount = 0;
852
- const fetchImpl = (_url, _init) => {
853
- callCount++;
854
- if (callCount === 1) {
855
- return Promise.resolve(makeMockResponse({ ok: true, jsonValue: rootWithOneFile('data.json') }));
856
- }
857
- if (callCount === 2) {
858
- return Promise.resolve(makeMockResponse({ ok: true, jsonValue: fileResponse('/data.json', '{}') }));
859
- }
860
- return Promise.resolve(makeMockResponse({ ok: false, status: 502, throwOnText: true }));
861
- };
862
- const accessors = (await file_tree_1.HttpTreeAccessors.fromHttp({
863
- baseUrl: 'http://localhost:3000',
864
- fetchImpl,
865
- mutable: true
866
- })).orThrow();
867
- accessors.saveFileContents('/data.json', '"updated"').orThrow();
868
- const result = await accessors.syncToDisk();
869
- expect(result).toFailWith(/http 502/i);
886
+ // 502 is transient so retries will be attempted; use fake timers to avoid real delays
887
+ jest.useFakeTimers();
888
+ try {
889
+ let callCount = 0;
890
+ const fetchImpl = (_url, _init) => {
891
+ callCount++;
892
+ if (callCount === 1) {
893
+ return Promise.resolve(makeMockResponse({ ok: true, jsonValue: rootWithOneFile('data.json') }));
894
+ }
895
+ if (callCount === 2) {
896
+ return Promise.resolve(makeMockResponse({ ok: true, jsonValue: fileResponse('/data.json', '{}') }));
897
+ }
898
+ return Promise.resolve(makeMockResponse({ ok: false, status: 502, throwOnText: true }));
899
+ };
900
+ const accessors = (await file_tree_1.HttpTreeAccessors.fromHttp({
901
+ baseUrl: 'http://localhost:3000',
902
+ fetchImpl,
903
+ mutable: true
904
+ })).orThrow();
905
+ accessors.saveFileContents('/data.json', '"updated"').orThrow();
906
+ const syncPromise = accessors.syncToDisk();
907
+ await jest.advanceTimersByTimeAsync(1500);
908
+ const result = await syncPromise;
909
+ expect(result).toFailWith(/http 502/i);
910
+ }
911
+ finally {
912
+ jest.useRealTimers();
913
+ }
870
914
  });
871
915
  });
872
916
  describe('_requestWithParams() error handling', () => {
@@ -998,5 +1042,190 @@ describe('HttpTreeAccessors', () => {
998
1042
  expect(methodCalls).toContain('POST');
999
1043
  });
1000
1044
  });
1045
+ describe('_requestWithRetry()', () => {
1046
+ test('succeeds on second attempt after a transient 503 error', async () => {
1047
+ jest.useFakeTimers();
1048
+ try {
1049
+ // Responses: init (GET tree/children), then PUT fails with 503, then PUT succeeds, then POST /sync succeeds
1050
+ let callCount = 0;
1051
+ const fetchImpl = (_url, _init) => {
1052
+ callCount++;
1053
+ if (callCount === 1) {
1054
+ return Promise.resolve(makeMockResponse({ ok: true, jsonValue: rootWithOneFile('data.json') }));
1055
+ }
1056
+ if (callCount === 2) {
1057
+ return Promise.resolve(makeMockResponse({ ok: true, jsonValue: fileResponse('/data.json', '{}') }));
1058
+ }
1059
+ // First PUT attempt: transient 503
1060
+ if (callCount === 3) {
1061
+ return Promise.resolve(makeMockResponse({ ok: false, status: 503, textValue: '503 Service Unavailable' }));
1062
+ }
1063
+ // Second PUT attempt: success
1064
+ if (callCount === 4) {
1065
+ return Promise.resolve(makeMockResponse({ ok: true, jsonValue: fileResponse('/data.json', '"updated"') }));
1066
+ }
1067
+ // POST /sync
1068
+ return Promise.resolve(makeMockResponse({ ok: true, jsonValue: { synced: 1 } }));
1069
+ };
1070
+ const accessors = (await file_tree_1.HttpTreeAccessors.fromHttp({
1071
+ baseUrl: 'http://localhost:3000',
1072
+ fetchImpl,
1073
+ mutable: true
1074
+ })).orThrow();
1075
+ accessors.saveFileContents('/data.json', '"updated"').orThrow();
1076
+ const syncPromise = accessors.syncToDisk();
1077
+ // Advance past the 500ms backoff for the first retry
1078
+ await jest.advanceTimersByTimeAsync(500);
1079
+ const result = await syncPromise;
1080
+ expect(result).toSucceed();
1081
+ // Three PUT-related calls: init (2) + first PUT attempt (1) + retry PUT (1) + POST sync (1)
1082
+ expect(callCount).toBe(5);
1083
+ }
1084
+ finally {
1085
+ jest.useRealTimers();
1086
+ }
1087
+ });
1088
+ test('does not retry on a non-transient error (e.g. 404)', async () => {
1089
+ jest.useFakeTimers();
1090
+ try {
1091
+ let callCount = 0;
1092
+ const fetchImpl = (_url, _init) => {
1093
+ callCount++;
1094
+ if (callCount === 1) {
1095
+ return Promise.resolve(makeMockResponse({ ok: true, jsonValue: rootWithOneFile('data.json') }));
1096
+ }
1097
+ if (callCount === 2) {
1098
+ return Promise.resolve(makeMockResponse({ ok: true, jsonValue: fileResponse('/data.json', '{}') }));
1099
+ }
1100
+ // PUT attempt: non-transient 404
1101
+ return Promise.resolve(makeMockResponse({ ok: false, status: 404, textValue: 'Not Found' }));
1102
+ };
1103
+ const accessors = (await file_tree_1.HttpTreeAccessors.fromHttp({
1104
+ baseUrl: 'http://localhost:3000',
1105
+ fetchImpl,
1106
+ mutable: true
1107
+ })).orThrow();
1108
+ accessors.saveFileContents('/data.json', '"updated"').orThrow();
1109
+ const result = await accessors.syncToDisk();
1110
+ // No timers should need advancing - non-transient errors return immediately
1111
+ expect(result).toFailWith(/not found/i);
1112
+ // Only 3 calls: 2 init + 1 PUT (no retries)
1113
+ expect(callCount).toBe(3);
1114
+ }
1115
+ finally {
1116
+ jest.useRealTimers();
1117
+ }
1118
+ });
1119
+ test('returns the last error after exhausting all retries on persistent transient errors', async () => {
1120
+ jest.useFakeTimers();
1121
+ try {
1122
+ let callCount = 0;
1123
+ const fetchImpl = (_url, _init) => {
1124
+ callCount++;
1125
+ if (callCount === 1) {
1126
+ return Promise.resolve(makeMockResponse({ ok: true, jsonValue: rootWithOneFile('data.json') }));
1127
+ }
1128
+ if (callCount === 2) {
1129
+ return Promise.resolve(makeMockResponse({ ok: true, jsonValue: fileResponse('/data.json', '{}') }));
1130
+ }
1131
+ // All PUT attempts: transient 502 every time
1132
+ return Promise.resolve(makeMockResponse({ ok: false, status: 502, textValue: '502 Bad Gateway' }));
1133
+ };
1134
+ const accessors = (await file_tree_1.HttpTreeAccessors.fromHttp({
1135
+ baseUrl: 'http://localhost:3000',
1136
+ fetchImpl,
1137
+ mutable: true
1138
+ })).orThrow();
1139
+ accessors.saveFileContents('/data.json', '"updated"').orThrow();
1140
+ const syncPromise = accessors.syncToDisk();
1141
+ // Advance past both backoff delays: 500ms (attempt 1) + 1000ms (attempt 2)
1142
+ await jest.advanceTimersByTimeAsync(1500);
1143
+ const result = await syncPromise;
1144
+ expect(result).toFailWith(/502 bad gateway/i);
1145
+ // 2 init + 3 PUT attempts (maxAttempts = 3)
1146
+ expect(callCount).toBe(5);
1147
+ }
1148
+ finally {
1149
+ jest.useRealTimers();
1150
+ }
1151
+ });
1152
+ test('logs retry message with method name from init when retrying', async () => {
1153
+ jest.useFakeTimers();
1154
+ try {
1155
+ const logger = {
1156
+ detail: jest.fn(),
1157
+ info: jest.fn(),
1158
+ warn: jest.fn(),
1159
+ error: jest.fn()
1160
+ };
1161
+ let callCount = 0;
1162
+ const fetchImpl = (_url, _init) => {
1163
+ callCount++;
1164
+ if (callCount === 1) {
1165
+ return Promise.resolve(makeMockResponse({ ok: true, jsonValue: rootWithOneFile('data.json') }));
1166
+ }
1167
+ if (callCount === 2) {
1168
+ return Promise.resolve(makeMockResponse({ ok: true, jsonValue: fileResponse('/data.json', '{}') }));
1169
+ }
1170
+ // First PUT attempt: transient 503
1171
+ if (callCount === 3) {
1172
+ return Promise.resolve(makeMockResponse({ ok: false, status: 503, textValue: '503 Service Unavailable' }));
1173
+ }
1174
+ // Second PUT attempt: success
1175
+ if (callCount === 4) {
1176
+ return Promise.resolve(makeMockResponse({ ok: true, jsonValue: fileResponse('/data.json', '"updated"') }));
1177
+ }
1178
+ // POST /sync
1179
+ return Promise.resolve(makeMockResponse({ ok: true, jsonValue: { synced: 1 } }));
1180
+ };
1181
+ const accessors = (await file_tree_1.HttpTreeAccessors.fromHttp({
1182
+ baseUrl: 'http://localhost:3000',
1183
+ fetchImpl,
1184
+ mutable: true,
1185
+ logger
1186
+ })).orThrow();
1187
+ accessors.saveFileContents('/data.json', '"updated"').orThrow();
1188
+ const syncPromise = accessors.syncToDisk();
1189
+ await jest.advanceTimersByTimeAsync(500);
1190
+ await syncPromise;
1191
+ // The retry log message should include the method name (PUT) from init
1192
+ expect(logger.detail).toHaveBeenCalledWith(expect.stringContaining('PUT'));
1193
+ }
1194
+ finally {
1195
+ jest.useRealTimers();
1196
+ }
1197
+ });
1198
+ });
1199
+ describe('syncToDisk() concurrency guard', () => {
1200
+ test('concurrent syncToDisk calls share the same promise and only make one set of network calls', async () => {
1201
+ const { fetchImpl, calls } = makeMockFetch([
1202
+ { ok: true, jsonValue: rootWithOneFile('data.json') },
1203
+ { ok: true, jsonValue: fileResponse('/data.json', '{}') },
1204
+ // PUT /file for the single sync
1205
+ { ok: true, jsonValue: fileResponse('/data.json', '"updated"') },
1206
+ // POST /sync
1207
+ { ok: true, jsonValue: { synced: 1 } }
1208
+ ]);
1209
+ const accessors = (await file_tree_1.HttpTreeAccessors.fromHttp({
1210
+ baseUrl: 'http://localhost:3000',
1211
+ fetchImpl,
1212
+ mutable: true
1213
+ })).orThrow();
1214
+ accessors.saveFileContents('/data.json', '"updated"').orThrow();
1215
+ // Start two concurrent syncToDisk calls without awaiting the first
1216
+ const promise1 = accessors.syncToDisk();
1217
+ const promise2 = accessors.syncToDisk();
1218
+ const [result1, result2] = await Promise.all([promise1, promise2]);
1219
+ expect(result1).toSucceed();
1220
+ expect(result2).toSucceed();
1221
+ // Both promises should have resolved to the same underlying promise result.
1222
+ // Only one PUT and one POST /sync should have been issued (not doubled).
1223
+ const syncCalls = calls.slice(2);
1224
+ const putCalls = syncCalls.filter((c) => { var _a; return ((_a = c.init) === null || _a === void 0 ? void 0 : _a.method) === 'PUT'; });
1225
+ const postCalls = syncCalls.filter((c) => { var _a; return ((_a = c.init) === null || _a === void 0 ? void 0 : _a.method) === 'POST'; });
1226
+ expect(putCalls).toHaveLength(1);
1227
+ expect(postCalls).toHaveLength(1);
1228
+ });
1229
+ });
1001
1230
  });
1002
1231
  //# sourceMappingURL=httpTreeAccessors.test.js.map