Skip to content

Commit 619360e

Browse files
coderabbitai[bot]CodeRabbit
andauthored
fix: apply CodeRabbit auto-fixes
Fixed 3 file(s) based on 4 unresolved review comments. Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
1 parent 938f716 commit 619360e

3 files changed

Lines changed: 17 additions & 12 deletions

File tree

tests/i18n.test.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import i18next from 'i18next';
33
import { t } from '../src/utils/i18n';
44

55
describe('i18n t()', () => {
6-
test('returns a non-empty translated string for a known key in English', () => {
7-
i18next.changeLanguage('en');
6+
test('returns a non-empty translated string for a known key in English', async () => {
7+
await i18next.changeLanguage('en');
88
const result = t('cancelled');
99
expect(typeof result).toBe('string');
1010
expect(result.length).toBeGreaterThan(0);
@@ -45,12 +45,11 @@ describe('i18n t()', () => {
4545
expect(result).toContain('abc');
4646
});
4747

48-
test('returns the key itself or a fallback for an unknown key', () => {
49-
i18next.changeLanguage('en');
48+
test('returns the key itself or a fallback for an unknown key', async () => {
49+
await i18next.changeLanguage('en');
5050
const result = t('this_key_does_not_exist_at_all');
5151
// i18next returns the key string when a key is missing
52-
expect(typeof result).toBe('string');
53-
expect(result.length).toBeGreaterThan(0);
52+
expect(result).toBe('this_key_does_not_exist_at_all');
5453
});
5554

5655
test('returns different strings for en and zh for the same key', () => {

tests/plugin-config.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ describe('plugin-config - sentry plugin', () => {
1616
await fs.remove(tmpDir);
1717
});
1818

19-
const sentryPlugin = plugins.find((p) => p.name === 'sentry')!;
19+
const sentryPlugin = plugins.find((p) => p.name === 'sentry');
2020

2121
test('sentry plugin exists in the plugins array', () => {
2222
expect(sentryPlugin).toBeDefined();
2323
});
2424

2525
test('sentry bundleParams are { sentry: true, sourcemap: true }', () => {
26-
expect(sentryPlugin.bundleParams).toEqual({
26+
expect(sentryPlugin?.bundleParams).toEqual({
2727
sentry: true,
2828
sourcemap: true,
2929
});
@@ -34,7 +34,7 @@ describe('plugin-config - sentry plugin', () => {
3434
const origCwd = process.cwd();
3535
process.chdir(tmpDir);
3636
try {
37-
const result = await sentryPlugin.detect();
37+
const result = await sentryPlugin?.detect();
3838
expect(result).toBe(false);
3939
} finally {
4040
process.chdir(origCwd);
@@ -51,7 +51,7 @@ describe('plugin-config - sentry plugin', () => {
5151
const origCwd = process.cwd();
5252
process.chdir(tmpDir);
5353
try {
54-
const result = await sentryPlugin.detect();
54+
const result = await sentryPlugin?.detect();
5555
expect(result).toBe(true);
5656
} finally {
5757
process.chdir(origCwd);
@@ -68,7 +68,7 @@ describe('plugin-config - sentry plugin', () => {
6868
const origCwd = process.cwd();
6969
process.chdir(tmpDir);
7070
try {
71-
const result = await sentryPlugin.detect();
71+
const result = await sentryPlugin?.detect();
7272
expect(result).toBe(true);
7373
} finally {
7474
process.chdir(origCwd);
@@ -90,7 +90,7 @@ describe('plugin-config - sentry plugin', () => {
9090
const origCwd = process.cwd();
9191
process.chdir(tmpDir);
9292
try {
93-
const result = await sentryPlugin.detect();
93+
const result = await sentryPlugin?.detect();
9494
expect(result).toBe(true);
9595
} finally {
9696
process.chdir(origCwd);

tests/user.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@ describe('userCommands.login', () => {
7676
});
7777

7878
expect(saveSessionSpy).toHaveBeenCalled();
79+
expect(replaceSessionSpy).toHaveBeenCalled();
80+
81+
// Verify call order: replaceSession should be called before saveSession
82+
const replaceOrder = replaceSessionSpy.mock.invocationCallOrder[0];
83+
const saveOrder = saveSessionSpy.mock.invocationCallOrder[0];
84+
expect(replaceOrder).toBeLessThan(saveOrder);
7985
});
8086

8187
test('prompts for email and password when args are missing', async () => {

0 commit comments

Comments
 (0)