Skip to content

Commit 8408336

Browse files
committed
update tests
1 parent e51faac commit 8408336

File tree

72 files changed

+543
-165
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+543
-165
lines changed

modules/10-basics/10-hello-world/test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// @ts-check
2+
13
import { expect, test, vi } from 'vitest'
24

35
test('hello world', async () => {
Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
// @ts-check
22

3-
import { expectOutput } from 'hexlet-basics/tests';
3+
import { expect, test, vi } from 'vitest'
44

5-
const expected = 'Robert\nStannis\nRenly';
6-
expectOutput(expected);
5+
test('hello world', async () => {
6+
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { });
7+
await import('./index.js')
8+
9+
const firstArg = consoleLogSpy.mock.calls[0]?.[0];
10+
11+
expect(firstArg).toBe('Robert\nStannis\nRenly')
12+
})

modules/10-basics/45-testing/test.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
import { expectOutput } from 'hexlet-basics/tests';
1+
// @ts-check
22

3-
const expected = '9780262531962';
4-
expectOutput(expected);
3+
import { expect, test, vi } from 'vitest'
4+
5+
test('hello world', async () => {
6+
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { });
7+
await import('./index.js')
8+
9+
const firstArg = consoleLogSpy.mock.calls[0]?.[0];
10+
11+
expect(firstArg).toBe('9780262531962')
12+
})
Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
import { expectOutput } from 'hexlet-basics/tests';
1+
// @ts-check
22

3-
const expected = 'What Is Dead May Never Die';
4-
expectOutput(expected);
3+
import { expect, test, vi } from 'vitest'
4+
5+
test('hello world', async () => {
6+
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { });
7+
await import('./index.js')
8+
9+
const firstArg = consoleLogSpy.mock.calls[0]?.[0];
10+
11+
expect(firstArg).toBe('What Is Dead May Never Die')
12+
})
Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
import { expectOutput } from 'hexlet-basics/tests';
1+
// @ts-check
22

3-
const expected = '9';
4-
expectOutput(expected);
3+
import { expect, test, vi } from 'vitest'
4+
5+
test('hello world', async () => {
6+
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { });
7+
await import('./index.js')
8+
9+
const firstArg = consoleLogSpy.mock.calls[0]?.[0];
10+
11+
expect(firstArg).toBe('9')
12+
})
Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
import { expectOutput } from 'hexlet-basics/tests';
1+
// @ts-check
22

3-
const expected = '87';
4-
expectOutput(expected);
3+
import { expect, test, vi } from 'vitest'
4+
5+
test('hello world', async () => {
6+
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { });
7+
await import('./index.js')
8+
9+
const firstArg = consoleLogSpy.mock.calls[0]?.[0];
10+
11+
expect(firstArg).toBe('87')
12+
})
Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
import { expectOutput } from 'hexlet-basics/tests';
1+
// @ts-check
22

3-
const expected = '243\n2';
4-
expectOutput(expected);
3+
import { expect, test, vi } from 'vitest'
4+
5+
test('hello world', async () => {
6+
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { });
7+
await import('./index.js')
8+
9+
const firstArg = consoleLogSpy.mock.calls[0]?.[0];
10+
11+
expect(firstArg).toBe('243\n2')
12+
})
Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
import { expectOutput } from 'hexlet-basics/tests';
1+
// @ts-check
22

3-
const expected = '10.5';
4-
expectOutput(expected);
3+
import { expect, test, vi } from 'vitest'
4+
5+
test('hello world', async () => {
6+
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { });
7+
await import('./index.js')
8+
9+
const firstArg = consoleLogSpy.mock.calls[0]?.[0];
10+
11+
expect(firstArg).toBe('10.5')
12+
})
Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
import { expectOutput } from 'hexlet-basics/tests';
1+
// @ts-check
22

3-
const expected = '49';
4-
expectOutput(expected);
3+
import { expect, test, vi } from 'vitest'
4+
5+
test('hello world', async () => {
6+
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { });
7+
await import('./index.js')
8+
9+
const firstArg = consoleLogSpy.mock.calls[0]?.[0];
10+
11+
expect(firstArg).toBe('49')
12+
})
Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
import { expectOutput } from 'hexlet-basics/tests';
1+
// @ts-check
22

3-
const expected = 0.39 * 0.22;
4-
expectOutput(expected);
3+
import { expect, test, vi } from 'vitest'
4+
5+
test('hello world', async () => {
6+
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { });
7+
await import('./index.js')
8+
9+
const firstArg = consoleLogSpy.mock.calls[0]?.[0];
10+
11+
expect(firstArg).toBe('0.39 * 0.22')
12+
})

0 commit comments

Comments
 (0)