diff --git a/1-js/03-code-quality/05-testing-mocha/3-pow-test-wrong/solution.md b/1-js/03-code-quality/05-testing-mocha/3-pow-test-wrong/solution.md index 4d0571b9d..ae3a16a5c 100644 --- a/1-js/03-code-quality/05-testing-mocha/3-pow-test-wrong/solution.md +++ b/1-js/03-code-quality/05-testing-mocha/3-pow-test-wrong/solution.md @@ -1,14 +1,14 @@ -The test demonstrates one of the temptations a developer meets when writing tests. +این تست, نمونه ای از وسوسه‌هایی را که یک توسعه دهنده(برنامه نویس) هنگام نوشتن تست‌ها با آن رو به رو می‌شود را نشان می‌دهد. -What we have here is actually 3 tests, but layed out as a single function with 3 asserts. +آنچه که در اینجا داریم در واقع 3 تست است، اما به عنوان یک تابع با 3 دارایی(assert) نوشته شده است. -Sometimes it's easier to write this way, but if an error occurs, it's much less obvious what went wrong. +بعضی وقت ها نوشتن به این مدل ساده تر است، اما اگر خطایی رخ بدهد، خیلی کمتر مشخص میشود که مشکل از کجاست. -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*. +اگر خطایی در وسط اجرای یک جریان پیچیده رخ بدهد، در این مرحله باید داده ها را کشف کنیم. ما در واقع باید *تست را دیباگ(اشکال زدایی) کنیم*. -It would be much better to break the test into multiple `it` blocks with clearly written inputs and outputs. +خیلی بهتر میشود که تست را به چندین بلوک `it` با ورودی ها و خروجی های کامل نوشته شده تقسیم کنیم. -Like this: +مثل این: ```js describe("Raises x to power n", function() { it("5 in the power of 1 equals 5", function() { @@ -25,9 +25,9 @@ describe("Raises x to power n", function() { }); ``` -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. +ما یک `it` را با `describe` و گروهی از بلوک‌های `it` جایگزین میکنیم. حالا اگر مشکلی پیش بیاید، به وضوح می‌بینیم که داده‌ها چه بوده‌اند. -Also we can isolate a single test and run it in standalone mode by writing `it.only` instead of `it`: +همچنین می‌توانیم با نوشتن `it.only` به جای `it`، یک تست را جدا کرده و آن را در حالت مستقل(به تنهایی) اجرا کنیم: ```js diff --git a/1-js/03-code-quality/05-testing-mocha/3-pow-test-wrong/task.md b/1-js/03-code-quality/05-testing-mocha/3-pow-test-wrong/task.md index 66fece09a..57b9d4b53 100644 --- a/1-js/03-code-quality/05-testing-mocha/3-pow-test-wrong/task.md +++ b/1-js/03-code-quality/05-testing-mocha/3-pow-test-wrong/task.md @@ -2,9 +2,9 @@ importance: 5 --- -# What's wrong in the test? +# چه مشکلی در تست(آزمون) وجود دارد؟ -What's wrong in the test of `pow` below? +تست `pow` که در زیر آمده چه مشکلی دارد؟ ```js it("Raises x to the power n", function() { @@ -20,5 +20,4 @@ it("Raises x to the power n", function() { assert.equal(pow(x, 3), result); }); ``` - -P.S. Syntactically the test is correct and passes. +از نظر سینتکس(نحوی) تست درست است و قبول می شود.