Skip to content

Commit fecf1fd

Browse files
feyclaude
andcommitted
Strengthen tests: fail without solution (comments, undefined)
Comments test now asserts a TODO comment is present; undefined test asserts console.log was called with an undefined argument. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent a3dbe08 commit fecf1fd

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
11
// @ts-check
22

3-
import './index.js';
3+
import { readFileSync } from 'node:fs';
4+
import { fileURLToPath } from 'node:url';
5+
import { expect, test } from 'vitest';
6+
7+
test('comments', () => {
8+
const code = readFileSync(fileURLToPath(new URL('./index.js', import.meta.url)), 'utf-8');
9+
10+
// В коде должен быть хотя бы один строчный TODO-комментарий
11+
expect(code).toMatch(/\/\/\s*TODO/i);
12+
});

modules/33-data-types/45-undefined/test.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
import { expect, test, vi } from 'vitest';
44

5-
test('hello world', async () => {
5+
test('undefined', async () => {
66
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
77
await import('./index.js');
88

9-
const firstArg = consoleLogSpy.mock.calls[0]?.[0];
10-
11-
expect(firstArg).toBe(undefined);
9+
// console.log должен быть вызван, и ему должен быть передан аргумент undefined
10+
expect(consoleLogSpy).toHaveBeenCalled();
11+
const [firstCall] = consoleLogSpy.mock.calls;
12+
expect(firstCall.length).toBeGreaterThan(0);
13+
expect(firstCall[0]).toBe(undefined);
1214
});

0 commit comments

Comments
 (0)