Skip to content

Commit 5aeee84

Browse files
Update solution.md
1 parent bc6c357 commit 5aeee84

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

  • 1-js/03-code-quality/05-testing-mocha/3-pow-test-wrong

1-js/03-code-quality/05-testing-mocha/3-pow-test-wrong/solution.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
The test demonstrates one of the temptations a developer meets when writing tests.
1+
این تست، نمونه ای از وسوسه‌هایی را که یک توسعه دهنده(برنامه نویس) هنگام نوشتن تست‌ ها با آن رو به رو می‌شود را نشان می دهد.
22

3-
What we have here is actually 3 tests, but layed out as a single function with 3 asserts.
3+
آنچه که در اینجا داریم در واقع 3 تست است، اما به عنوان یک تابع با 3 assert نوشته شده است.
44

5-
Sometimes it's easier to write this way, but if an error occurs, it's much less obvious what went wrong.
5+
بعضی وقت ها نوشتن به این مدل ساده تر است، اما اگر خطایی رخ بدهد، خیلی کمتر مشخص میشود که مشکل از کجاست.
66

7-
If an error happens in the middle of a complex execution flow, then we'll have to figure out the data at that point. We'll actually have to *debug the test*.
7+
اگر خطایی در وسط اجرای یک جریان پیچیده رخ بدهد، در این مرحله باید داده ها را کشف کنیم. ما در واقع باید *تست را دیباگ(اشکال زدایی) کنیم*.
88

9-
It would be much better to break the test into multiple `it` blocks with clearly written inputs and outputs.
9+
خیلی بهتر میشود که تست را به چندین بلوک `it` با ورودی ها و خروجی های کامل نوشته شده تقسیم کنیم.
1010

11-
Like this:
11+
به طور مثال:
1212
```js
1313
describe("Raises x to power n", function() {
1414
it("5 in the power of 1 equals 5", function() {
@@ -25,9 +25,9 @@ describe("Raises x to power n", function() {
2525
});
2626
```
2727

28-
We replaced the single `it` with `describe` and a group of `it` blocks. Now if something fails we would see clearly what the data was.
28+
ما یک `it` را با `describe` و گروهی از بلوک‌های `it` جایگزین میکنیم. حالا اگر مشکلی پیش بیاید، به وضوح می‌بینیم که داده‌ها چه بوده‌اند.
2929

30-
Also we can isolate a single test and run it in standalone mode by writing `it.only` instead of `it`:
30+
همچنین می‌توانیم با نوشتن `it.only` به جای `it`، یک تست را جدا کرده و آن را در حالت مستقل(به تنهایی) اجرا کنیم:
3131

3232

3333
```js

0 commit comments

Comments
 (0)