-
Notifications
You must be signed in to change notification settings - Fork 4
update tests #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update tests #10
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
FROM hexletbasics/base-image | ||
|
||
WORKDIR /exercises-pre-course-javascript | ||
|
||
COPY . . | ||
|
||
ENV NODE_PATH /exercises-pre-course-javascript/src | ||
Check warning on line 3 in Dockerfile
|
||
ENV PATH=/exercises-pre-course-javascript/bin:$PATH | ||
|
||
WORKDIR /exercises-pre-course-javascript | ||
|
||
RUN npm i -g vitest | ||
COPY package.json package-lock.json ./ | ||
RUN npm ci | ||
|
||
ENV PATH=/exercises-pre-course-javascript/bin:$PATH | ||
COPY . . |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
FORCE_COLOR=1 vitest related --run `pwd`/test.js |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
test: | ||
@ test-output.sh | ||
@ test2.sh |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,14 @@ | ||
// @ts-check | ||
|
||
import { expectOutput } from 'hexlet-basics/tests'; | ||
import { expect, test, vi } from 'vitest' | ||
|
||
const expected = 'Hello, World!'; | ||
expectOutput(expected); | ||
|
||
test('hello world', async () => { | ||
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { }); | ||
await import('./index.js') | ||
|
||
const firstArg = consoleLogSpy.mock.calls.join('\n'); | ||
|
||
expect(firstArg).toBe(expected) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
test: | ||
@ test-output.sh | ||
@ test2.sh |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
test: | ||
@ test-output.sh | ||
@ test2.sh |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,14 @@ | ||
// @ts-check | ||
|
||
import { expectOutput } from 'hexlet-basics/tests'; | ||
import { expect, test, vi } from 'vitest' | ||
|
||
const expected = 'Robert\nStannis\nRenly'; | ||
expectOutput(expected); | ||
|
||
test('hello world', async () => { | ||
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { }); | ||
await import('./index.js') | ||
|
||
const firstArg = consoleLogSpy.mock.calls.join('\n'); | ||
|
||
expect(firstArg).toBe(expected) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
test: | ||
@ test-output.sh | ||
@ test2.sh |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
import { expectOutput } from 'hexlet-basics/tests'; | ||
import { expect, test, vi } from 'vitest' | ||
|
||
const expected = '9780262531962'; | ||
expectOutput(expected); | ||
|
||
test('hello world', async () => { | ||
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { }); | ||
await import('./index.js') | ||
|
||
const firstArg = consoleLogSpy.mock.calls.join('\n'); | ||
|
||
expect(firstArg).toBe(expected) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
test: | ||
@ test-output.sh | ||
@ test2.sh |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
import { expectOutput } from 'hexlet-basics/tests'; | ||
import { expect, test, vi } from 'vitest' | ||
|
||
const expected = 'What Is Dead May Never Die'; | ||
expectOutput(expected); | ||
|
||
test('hello world', async () => { | ||
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { }); | ||
await import('./index.js') | ||
|
||
const firstArg = consoleLogSpy.mock.calls.join('\n'); | ||
|
||
expect(firstArg).toBe(expected) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
test: | ||
@ test-output.sh | ||
@ test2.sh |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
import { expectOutput } from 'hexlet-basics/tests'; | ||
import { expect, test, vi } from 'vitest' | ||
|
||
const expected = '9'; | ||
expectOutput(expected); | ||
|
||
test('hello world', async () => { | ||
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { }); | ||
await import('./index.js') | ||
|
||
const firstArg = consoleLogSpy.mock.calls.join('\n'); | ||
|
||
expect(firstArg).toBe(expected) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
test: | ||
@ test-output.sh | ||
@ test2.sh |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
import { expectOutput } from 'hexlet-basics/tests'; | ||
import { expect, test, vi } from 'vitest' | ||
|
||
const expected = '87'; | ||
expectOutput(expected); | ||
|
||
test('hello world', async () => { | ||
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { }); | ||
await import('./index.js') | ||
|
||
const firstArg = consoleLogSpy.mock.calls.join('\n'); | ||
|
||
expect(firstArg).toBe(expected) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
test: | ||
@ test-output.sh | ||
@ test2.sh |
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -1,4 +1,12 @@ | ||||
import { expectOutput } from 'hexlet-basics/tests'; | ||||
import { expect, test, vi } from 'vitest' | ||||
|
||||
const expected = '243\n2'; | ||||
expectOutput(expected); | ||||
|
||||
test('hello world', async () => { | ||||
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { }); | ||||
await import('./index.js') | ||||
|
||||
const firstArg = consoleLogSpy.mock.calls.join('\n'); | ||||
|
||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dzencot эта штука повторяется неск раз. Ее можно вынести в общий модуль? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. У нас это уже выделено отдельно
|
||||
expect(firstArg).toBe(expected) | ||||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
test: | ||
@ test-output.sh | ||
@ test2.sh |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
import { expectOutput } from 'hexlet-basics/tests'; | ||
import { expect, test, vi } from 'vitest' | ||
|
||
const expected = '10.5'; | ||
expectOutput(expected); | ||
|
||
test('hello world', async () => { | ||
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { }); | ||
await import('./index.js') | ||
|
||
const firstArg = consoleLogSpy.mock.calls.join('\n'); | ||
|
||
expect(firstArg).toBe(expected) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
test: | ||
@ test-output.sh | ||
@ test2.sh |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
import { expectOutput } from 'hexlet-basics/tests'; | ||
import { expect, test, vi } from 'vitest' | ||
|
||
const expected = '49'; | ||
expectOutput(expected); | ||
|
||
test('hello world', async () => { | ||
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { }); | ||
await import('./index.js') | ||
|
||
const firstArg = consoleLogSpy.mock.calls.join('\n'); | ||
|
||
expect(firstArg).toBe(expected) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
test: | ||
@ test-output.sh | ||
@ test2.sh |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
import { expectOutput } from 'hexlet-basics/tests'; | ||
import { expect, test, vi } from 'vitest' | ||
|
||
const expected = 0.39 * 0.22; | ||
expectOutput(expected); | ||
|
||
test('hello world', async () => { | ||
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { }); | ||
await import('./index.js') | ||
|
||
const firstArg = consoleLogSpy.mock.calls[0]?.[0]; | ||
|
||
expect(firstArg).toBe(expected) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
test: | ||
@ test-output.sh | ||
@ test2.sh |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
import { expectOutput } from 'hexlet-basics/tests'; | ||
import { expect, test, vi } from 'vitest' | ||
|
||
const expected = Infinity; | ||
expectOutput(expected); | ||
|
||
test('hello world', async () => { | ||
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { }); | ||
await import('./index.js') | ||
|
||
const firstArg = consoleLogSpy.mock.calls[0]?.[0]; | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. А в чем отличие от There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Здесь берем именно что было передано в первый вызов console.log. при чем получаем не строковое значение, а тот тип, который был передан There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. окей, понял, вижу что в хелоу ворлде так сделано |
||
expect(firstArg).toBe(expected) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
test: | ||
@ test-output.sh | ||
@ test2.sh |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
import { expectOutput } from 'hexlet-basics/tests'; | ||
import { expect, test, vi } from 'vitest' | ||
|
||
const expected = 'NaN'; | ||
expectOutput(expected); | ||
|
||
test('hello world', async () => { | ||
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { }); | ||
await import('./index.js') | ||
|
||
const firstArg = consoleLogSpy.mock.calls.join('\n'); | ||
|
||
expect(firstArg).toBe(expected) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
test: | ||
@ test-output.sh | ||
@ test2.sh |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
import { expectOutput } from 'hexlet-basics/tests'; | ||
import { expect, test, vi } from 'vitest' | ||
|
||
const expected = '4'; | ||
expectOutput(expected); | ||
|
||
test('hello world', async () => { | ||
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { }); | ||
await import('./index.js') | ||
|
||
const firstArg = consoleLogSpy.mock.calls.join('\n'); | ||
|
||
expect(firstArg).toBe(expected) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
test: | ||
@ test-output.sh | ||
@ test2.sh |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
import { expectOutput } from 'hexlet-basics/tests'; | ||
import { expect, test, vi } from 'vitest' | ||
|
||
const expected = "\"Khal Drogo's favorite word is \"athjahakar\"\""; | ||
expectOutput(expected); | ||
|
||
test('hello world', async () => { | ||
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { }); | ||
await import('./index.js') | ||
|
||
const firstArg = consoleLogSpy.mock.calls.join('\n'); | ||
|
||
expect(firstArg).toBe(expected) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
test: | ||
@ test-output.sh | ||
@ test2.sh |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
import { expectOutput } from 'hexlet-basics/tests'; | ||
import { expect, test, vi } from 'vitest' | ||
|
||
const expected = '- Did Joffrey agree?\n- He did. He also said "I love using \\n".'; | ||
expectOutput(expected); | ||
|
||
test('hello world', async () => { | ||
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { }); | ||
await import('./index.js') | ||
|
||
const firstArg = consoleLogSpy.mock.calls.join('\n'); | ||
|
||
expect(firstArg).toBe(expected) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
test: | ||
@ test-output.sh | ||
@ test2.sh |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
import { expectOutput } from 'hexlet-basics/tests'; | ||
import { expect, test, vi } from 'vitest' | ||
|
||
const expected = 'Winter came for the House of Frey.'; | ||
expectOutput(expected); | ||
|
||
test('hello world', async () => { | ||
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { }); | ||
await import('./index.js') | ||
|
||
const firstArg = consoleLogSpy.mock.calls.join('\n'); | ||
|
||
expect(firstArg).toBe(expected) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
test: | ||
@ test-output.sh | ||
@ test2.sh |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
import { expectOutput } from 'hexlet-basics/tests'; | ||
import { expect, test, vi } from 'vitest' | ||
|
||
const expected = '~\n^\n%'; | ||
expectOutput(expected); | ||
|
||
test('hello world', async () => { | ||
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { }); | ||
await import('./index.js') | ||
|
||
const firstArg = consoleLogSpy.mock.calls.join('\n'); | ||
|
||
expect(firstArg).toBe(expected) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
test: | ||
@ test-output.sh | ||
@ test2.sh |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
import { expectOutput } from 'hexlet-basics/tests'; | ||
import { expect, test, vi } from 'vitest' | ||
|
||
const expected = 'What Is Dead May Never Die!'; | ||
expectOutput(expected); | ||
|
||
test('hello world', async () => { | ||
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { }); | ||
await import('./index.js') | ||
|
||
const firstArg = consoleLogSpy.mock.calls.join('\n'); | ||
|
||
expect(firstArg).toBe(expected) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
test: | ||
@ test-output.sh | ||
@ test2.sh |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
import { expectOutput } from 'hexlet-basics/tests'; | ||
import { expect, test, vi } from 'vitest' | ||
|
||
const expected = 'anneirB'; | ||
expectOutput(expected); | ||
|
||
test('hello world', async () => { | ||
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => { }); | ||
await import('./index.js') | ||
|
||
const firstArg = consoleLogSpy.mock.calls.join('\n'); | ||
|
||
expect(firstArg).toBe(expected) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
test: | ||
@ test-output.sh | ||
@ test2.sh |
Uh oh!
There was an error while loading. Please reload this page.