Skip to content

Commit d64b997

Browse files
committed
refactor(tests): update test descriptions to English for consistency
1 parent b9a393b commit d64b997

File tree

5 files changed

+138
-138
lines changed

5 files changed

+138
-138
lines changed

packages/core/tests/action-observer.test.ts

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ describe('ActionObserver', () => {
3131
ConnectivityClient.resetInstance();
3232
});
3333

34-
test('constructor에서 action을 등록한다', async () => {
34+
test('registers action in constructor', async () => {
3535
const mock = createMockDetector();
3636
const client = getConnectivityClient({ detectors: [mock.detector] });
3737
client.start();
@@ -42,11 +42,11 @@ describe('ActionObserver', () => {
4242
request: vi.fn().mockResolvedValue('ok'),
4343
});
4444

45-
// action이 등록되었으므로 execute가 throw하지 않아야 함
45+
// action is registered, so execute should not throw
4646
await expect(client.execute('save', {})).resolves.toBeDefined();
4747
});
4848

49-
test('setOptions로 action을 재등록한다', async () => {
49+
test('re-registers action via setOptions', async () => {
5050
const mock = createMockDetector();
5151
const client = getConnectivityClient({ detectors: [mock.detector] });
5252
client.start();
@@ -67,7 +67,7 @@ describe('ActionObserver', () => {
6767
expect(fn2).toHaveBeenCalledOnce();
6868
});
6969

70-
test('getCurrentResult가 pendingCount와 lastError를 반환한다', async () => {
70+
test('getCurrentResult returns pendingCount and lastError', async () => {
7171
const mock = createMockDetector();
7272
const client = getConnectivityClient({ detectors: [mock.detector] });
7373
client.start();
@@ -87,7 +87,7 @@ describe('ActionObserver', () => {
8787
expect(result.lastError).toBeUndefined();
8888
});
8989

90-
test('execute 성공 시 onSuccess callback이 호출된다', async () => {
90+
test('onSuccess callback is called when execute succeeds', async () => {
9191
const mock = createMockDetector();
9292
const client = getConnectivityClient({ detectors: [mock.detector] });
9393
client.start();
@@ -105,7 +105,7 @@ describe('ActionObserver', () => {
105105
expect(onSuccess).toHaveBeenCalledWith({ id: '42' });
106106
});
107107

108-
test('execute 큐잉 시 onEnqueued callback이 호출된다', async () => {
108+
test('onEnqueued callback is called when execute is queued', async () => {
109109
const mock = createMockDetector();
110110
const client = getConnectivityClient({ detectors: [mock.detector] });
111111
client.start();
@@ -124,7 +124,7 @@ describe('ActionObserver', () => {
124124
expect(onEnqueued).toHaveBeenCalledWith(expect.stringContaining('job_'));
125125
});
126126

127-
test('execute 실패 + onError callback이 에러를 삼킨다', async () => {
127+
test('execute failure + onError callback swallows error', async () => {
128128
const mock = createMockDetector();
129129
const client = getConnectivityClient({ detectors: [mock.detector] });
130130
client.start();
@@ -134,20 +134,20 @@ describe('ActionObserver', () => {
134134
const observer = new ActionObserver(client, {
135135
actionKey: 'save',
136136
request: async () => {
137-
throw new Error('실패');
137+
throw new Error('failed');
138138
},
139139
});
140140
observer.setCallbacks({ onError });
141141

142142
const result = await observer.execute({});
143143

144144
expect(onError).toHaveBeenCalledWith(
145-
expect.objectContaining({ message: '실패' }),
145+
expect.objectContaining({ message: 'failed' }),
146146
);
147147
expect(result).toBeUndefined();
148148
});
149149

150-
test('onSettled가 성공/실패 모두에서 호출된다', async () => {
150+
test('onSettled is called on both success and failure', async () => {
151151
const mock = createMockDetector();
152152
const client = getConnectivityClient({ detectors: [mock.detector] });
153153
client.start();
@@ -164,7 +164,7 @@ describe('ActionObserver', () => {
164164
expect(onSettled).toHaveBeenCalledOnce();
165165
});
166166

167-
test('getCurrentResult는 값이 같으면 동일 참조를 반환한다 (memoize)', async () => {
167+
test('getCurrentResult returns same reference when value is equal (memoize)', async () => {
168168
const mock = createMockDetector();
169169
const client = getConnectivityClient({ detectors: [mock.detector] });
170170
client.start();
@@ -181,11 +181,11 @@ describe('ActionObserver', () => {
181181
const result1 = observer.getCurrentResult();
182182
const result2 = observer.getCurrentResult();
183183

184-
// 값이 같으므로 같은 참조 → useSyncExternalStore가 re-render하지 않음
184+
// same value → same reference → useSyncExternalStore does not re-render
185185
expect(result1).toBe(result2);
186186
});
187187

188-
test('getCurrentResult는 값이 달라지면 새 참조를 반환한다', async () => {
188+
test('getCurrentResult returns new reference when value changes', async () => {
189189
const mock = createMockDetector();
190190
const client = getConnectivityClient({ detectors: [mock.detector] });
191191
client.start();
@@ -207,7 +207,7 @@ describe('ActionObserver', () => {
207207
expect(result1).not.toBe(result2);
208208
});
209209

210-
test('다른 action의 큐 변경 시 getCurrentResult 참조가 유지된다', async () => {
210+
test('getCurrentResult reference is preserved when other action queue changes', async () => {
211211
const mock = createMockDetector();
212212
const client = getConnectivityClient({ detectors: [mock.detector] });
213213
client.start();
@@ -227,16 +227,16 @@ describe('ActionObserver', () => {
227227
await observer.execute({});
228228
const result1 = observer.getCurrentResult();
229229

230-
// 다른 action에 job 추가
230+
// add job to other action
231231
await client.execute('other', {});
232232

233233
const result2 = observer.getCurrentResult();
234234

235-
// save의 pendingCount는 여전히 1 → 같은 참조
235+
// save's pendingCount is still 1 → same reference
236236
expect(result1).toBe(result2);
237237
});
238238

239-
test('setCallbacks로 callback을 갱신하면 최신 callback이 호출된다', async () => {
239+
test('updating callback via setCallbacks invokes the latest callback', async () => {
240240
const mock = createMockDetector();
241241
const client = getConnectivityClient({ detectors: [mock.detector] });
242242
client.start();
@@ -250,16 +250,16 @@ describe('ActionObserver', () => {
250250
});
251251

252252
observer.setCallbacks({ onSuccess: onSuccess1 });
253-
observer.setCallbacks({ onSuccess: onSuccess2 }); // 갱신
253+
observer.setCallbacks({ onSuccess: onSuccess2 }); // update
254254

255255
await observer.execute({});
256256

257257
expect(onSuccess1).not.toHaveBeenCalled();
258258
expect(onSuccess2).toHaveBeenCalledOnce();
259259
});
260260

261-
describe('flush 경로 콜백', () => {
262-
test('flush 성공 시 onSuccess와 onSettled가 호출된다', async () => {
261+
describe('flush path callbacks', () => {
262+
test('onSuccess and onSettled are called when flush succeeds', async () => {
263263
const mock = createMockDetector();
264264
const client = getConnectivityClient({ detectors: [mock.detector] });
265265
client.start();
@@ -283,7 +283,7 @@ describe('ActionObserver', () => {
283283
expect(onSettled).toHaveBeenCalledOnce();
284284
});
285285

286-
test('flush 최종 실패 시 onError와 onSettled가 호출된다', async () => {
286+
test('onError and onSettled are called when flush finally fails', async () => {
287287
const mock = createMockDetector();
288288
const client = getConnectivityClient({ detectors: [mock.detector] });
289289
client.start();
@@ -293,7 +293,7 @@ describe('ActionObserver', () => {
293293
const onSettled = vi.fn();
294294
const observer = new ActionObserver(client, {
295295
actionKey: 'save',
296-
request: vi.fn().mockRejectedValue(new Error('flush 실패')),
296+
request: vi.fn().mockRejectedValue(new Error('flush failed')),
297297
whenOffline: 'queue',
298298
});
299299
observer.setCallbacks({ onError, onSettled });
@@ -304,12 +304,12 @@ describe('ActionObserver', () => {
304304
await vi.advanceTimersByTimeAsync(0);
305305

306306
expect(onError).toHaveBeenCalledWith(
307-
expect.objectContaining({ message: 'flush 실패' }),
307+
expect.objectContaining({ message: 'flush failed' }),
308308
);
309309
expect(onSettled).toHaveBeenCalledOnce();
310310
});
311311

312-
test('flush 시 setCallbacks 갱신 후 최신 callback이 호출된다', async () => {
312+
test('latest callback is called after setCallbacks update during flush', async () => {
313313
const mock = createMockDetector();
314314
const client = getConnectivityClient({ detectors: [mock.detector] });
315315
client.start();
@@ -326,7 +326,7 @@ describe('ActionObserver', () => {
326326
observer.setCallbacks({ onSuccess: onSuccess1 });
327327
await observer.execute({});
328328

329-
observer.setCallbacks({ onSuccess: onSuccess2 }); // re-render 시뮬레이션
329+
observer.setCallbacks({ onSuccess: onSuccess2 }); // simulate re-render
330330

331331
mock.emit({ status: 'online', reason: 'test' });
332332
await vi.advanceTimersByTimeAsync(0);

packages/core/tests/action-options.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { describe, expect, test } from 'vitest';
22
import { actionOptions } from '../src/action-options';
33

44
describe('actionOptions', () => {
5-
test('입력 config를 그대로 반환한다 (identity function)', () => {
5+
test('returns input config as-is (identity function)', () => {
66
const config = {
77
actionKey: 'save',
88
request: async (input: { id: string }) => ({ saved: true, id: input.id }),
@@ -11,7 +11,7 @@ describe('actionOptions', () => {
1111
expect(actionOptions(config)).toBe(config);
1212
});
1313

14-
test('dedupeKey에서 input 타입이 request의 input과 동일하게 추론된다', () => {
14+
test('dedupeKey input type is inferred same as request input', () => {
1515
const opts = actionOptions({
1616
actionKey: 'save',
1717
request: async (_input: { designId: string; data: string }) => ({
@@ -22,7 +22,7 @@ describe('actionOptions', () => {
2222
expect(opts.dedupeKey?.({ designId: 'd1', data: 'v1' })).toBe('d1');
2323
});
2424

25-
test('모든 옵션 필드가 보존된다', () => {
25+
test('all option fields are preserved', () => {
2626
const opts = actionOptions({
2727
actionKey: 'upload',
2828
request: async (_input: { file: string }) => ({ url: 'https://...' }),

0 commit comments

Comments
 (0)