Skip to content

Commit c1179fe

Browse files
Copiloteleanorjboyd
andcommitted
Reorganize test suites into logical groupings by functionality
Co-authored-by: eleanorjboyd <26030610+eleanorjboyd@users.noreply.github.com>
1 parent a4a4dab commit c1179fe

1 file changed

Lines changed: 14 additions & 12 deletions

File tree

src/test/features/settings/settingsValidation.unit.test.ts

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ interface MockPersistentState {
2525
clear: sinon.SinonStub;
2626
}
2727

28-
suite('Settings Validation Tests', () => {
28+
suite('pythonProjects Settings Validation', () => {
2929
let mockGetConfiguration: sinon.SinonStub;
3030
let mockGetWorkspaceFolders: sinon.SinonStub;
3131
let mockShowWarningMessage: sinon.SinonStub;
@@ -57,7 +57,7 @@ suite('Settings Validation Tests', () => {
5757
sinon.restore();
5858
});
5959

60-
suite('validatePythonProjectsSettings', () => {
60+
suite('Valid Settings Scenarios', () => {
6161
test('should return empty array when no workspaces exist', () => {
6262
// Mock → No workspaces
6363
mockGetWorkspaceFolders.returns([]);
@@ -89,7 +89,7 @@ suite('Settings Validation Tests', () => {
8989
assert.strictEqual(result.length, 0, 'Should return empty array for valid empty settings');
9090
});
9191

92-
test('should return empty array when all entries are valid', () => {
92+
test('should pass with valid entries containing all required fields', () => {
9393
// Mock → Valid pythonProjects entries
9494
const workspaceUri = Uri.file('/workspace');
9595
mockGetWorkspaceFolders.returns([{ name: 'test-workspace', uri: workspaceUri, index: 0 }]);
@@ -121,7 +121,9 @@ suite('Settings Validation Tests', () => {
121121
// Assert
122122
assert.strictEqual(result.length, 0, 'Should return empty array when all entries are valid');
123123
});
124+
});
124125

126+
suite('Invalid Entry Detection', () => {
125127
test('should detect missing path field', () => {
126128
// Mock → Entry missing path field
127129
const workspaceUri = Uri.file('/workspace');
@@ -282,8 +284,8 @@ suite('Settings Validation Tests', () => {
282284
});
283285
});
284286

285-
suite('notifyInvalidPythonProjectsSettings', () => {
286-
test('should not show notification when no invalid entries', async () => {
287+
suite('User Notification Behavior', () => {
288+
test('should not show notification when no invalid entries exist', async () => {
287289
// Mock → No invalid entries
288290
const invalidEntries: never[] = [];
289291

@@ -298,7 +300,7 @@ suite('Settings Validation Tests', () => {
298300
);
299301
});
300302

301-
test('should not show notification when user chose "don\'t show again"', async () => {
303+
test('should respect user preference to suppress notifications', async () => {
302304
// Mock → User previously selected "don't show again"
303305
mockPersistentState.get.resolves(true);
304306

@@ -321,7 +323,7 @@ suite('Settings Validation Tests', () => {
321323
);
322324
});
323325

324-
test('should show notification with correct message for single invalid entry', async () => {
326+
test('should display singular message for one invalid entry', async () => {
325327
// Mock → One invalid entry
326328
const invalidEntries = [
327329
{
@@ -345,7 +347,7 @@ suite('Settings Validation Tests', () => {
345347
);
346348
});
347349

348-
test('should show notification with correct message for multiple invalid entries', async () => {
350+
test('should display plural message with count for multiple invalid entries', async () => {
349351
// Mock → Multiple invalid entries
350352
const invalidEntries = [
351353
{
@@ -372,7 +374,7 @@ suite('Settings Validation Tests', () => {
372374
assert.ok(message.includes('entries'), 'Message should be plural for multiple entries');
373375
});
374376

375-
test('should save preference when user selects "don\'t show again"', async () => {
377+
test('should persist user choice to suppress future notifications', async () => {
376378
// Mock → User selects "don't show again"
377379
const invalidEntries = [
378380
{
@@ -398,8 +400,8 @@ suite('Settings Validation Tests', () => {
398400
});
399401
});
400402

401-
suite('validateAndNotifyPythonProjectsSettings', () => {
402-
test('should validate and notify when invalid entries exist', async () => {
403+
suite('End-to-End Validation Flow', () => {
404+
test('should detect invalid entries and show notification', async () => {
403405
// Mock → Invalid entry exists
404406
const workspaceUri = Uri.file('/workspace');
405407
mockGetWorkspaceFolders.returns([{ name: 'test-workspace', uri: workspaceUri, index: 0 }]);
@@ -428,7 +430,7 @@ suite('Settings Validation Tests', () => {
428430
assert.strictEqual(mockShowWarningMessage.callCount, 1, 'Should show notification');
429431
});
430432

431-
test('should not notify when all entries are valid', async () => {
433+
test('should skip notification when all entries are valid', async () => {
432434
// Mock → All valid entries
433435
const workspaceUri = Uri.file('/workspace');
434436
mockGetWorkspaceFolders.returns([{ name: 'test-workspace', uri: workspaceUri, index: 0 }]);

0 commit comments

Comments
 (0)