Skip to content

Commit 267f073

Browse files
committed
remove extra comments from jest test
1 parent 1790e73 commit 267f073

File tree

1 file changed

+0
-25
lines changed

1 file changed

+0
-25
lines changed

packages/devextreme/js/__internal/grids/tree_list/data_source_adapter/m_data_source_adapter.test.ts

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
/* eslint-disable @typescript-eslint/no-explicit-any */
2-
/* eslint-disable @typescript-eslint/no-unsafe-return */
3-
/* eslint-disable @typescript-eslint/init-declarations */
4-
/* eslint-disable @typescript-eslint/ban-ts-comment */
5-
/* eslint-disable @typescript-eslint/explicit-function-return-type */
6-
71
import {
82
afterEach, beforeEach, describe, expect, jest, test,
93
} from '@jest/globals';
@@ -44,13 +38,6 @@ describe('TreeList DataSourceAdapter - T1311885 Race Condition', () => {
4438
loadCalls.push({ filter: options?.filter, deferred });
4539
return deferred.promise();
4640
},
47-
// byKey: jest.fn((key: any) => {
48-
// // @ts-expect-error
49-
// const deferred = new Deferred();
50-
// const item = parentData.find((p) => p.Task_ID === key);
51-
// deferred.resolve(item);
52-
// return deferred.promise();
53-
// }),
5441
});
5542

5643
const dataSource = new DataSource({
@@ -100,11 +87,8 @@ describe('TreeList DataSourceAdapter - T1311885 Race Condition', () => {
10087
});
10188

10289
afterEach(() => {
103-
// Cleanup mocks and spies
10490
jest.clearAllMocks();
10591
jest.restoreAllMocks();
106-
107-
// Clear references to prevent memory leaks
10892
loadCalls = [];
10993
(dataSourceAdapter as any)._loadDataSource = undefined;
11094
(dataSourceAdapter as any).loadFromStore = undefined;
@@ -121,51 +105,42 @@ describe('TreeList DataSourceAdapter - T1311885 Race Condition', () => {
121105
};
122106
process.on('unhandledRejection', unhandledRejectionHandler);
123107

124-
// Setup initial state
125108
(dataSourceAdapter as any)._cachedStoreData = parentData;
126109
(dataSourceAdapter as any)._dataSource = {
127110
store: jest.fn(() => mockStore),
128111
};
129112
(dataSourceAdapter as any)._lastOperationId = OPERATION_ID.FIRST;
130113

131-
// Mock options
132114
const options = {
133115
remoteOperations: { filtering: true },
134116
storeLoadOptions: { sort: null },
135117
loadOptions: { sort: null },
136118
operationId: OPERATION_ID.FIRST,
137119
};
138120

139-
// Spy on loadFromStore to capture and control the deferred
140-
141121
// eslint-disable-next-line @typescript-eslint/no-unused-vars
142122
(dataSourceAdapter as any).loadFromStore = jest.fn((loadOptions, store) => {
143123
// @ts-expect-error
144124
const deferred = new Deferred();
145125

146-
// Save first deferred for later manipulation
147126
if (!firstLoadDeferred) {
148127
firstLoadDeferred = deferred;
149128
}
150129

151130
return deferred.promise();
152131
});
153132

154-
// STEP 1: Start first _loadParentsOrChildren call (parent lookup)
155133
(dataSourceAdapter as any)._loadParentsOrChildren(
156134
childData,
157135
options,
158136
);
159137

160-
// Verify loadFromStore was called
161138
expect((dataSourceAdapter as any).loadFromStore).toHaveBeenCalledTimes(1);
162139
expect(firstLoadDeferred).toBeDefined();
163140

164-
// STEP 2: Simulate reload() - clears _cachedStoreData
165141
(dataSourceAdapter as any)._cachedStoreData = undefined;
166142
(dataSourceAdapter as any)._lastOperationId = OPERATION_ID.SECOND;
167143

168-
// STEP 3: Resolve OLD parent lookup
169144
firstLoadDeferred.resolve(parentData);
170145
await Promise.resolve();
171146

0 commit comments

Comments
 (0)