You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The newly added tests fail, because our implementation does not support them. That's how BDD is done: first we write failing tests, and then make an implementation for them.
336
+
Новодобавените тестове ще са неуспешним защото нашата имплементация не ги поддържа. Така се прави BDD: първо пишем тестове, които не минават и после правим тяхната имплементация.
337
337
338
-
```smart header="Other assertions"
339
-
Please note the assertion `assert.isNaN`: it checks for `NaN`.
338
+
```smart header="Други допускания"
339
+
Обърнете внимание на допускането `assert.isNaN`: то проверява за `NaN`.
340
340
341
-
There are other assertions in [Chai](http://chaijs.com) as well, for instance:
341
+
Има и други допускания в [Chai](http://chaijs.com) например:
342
342
343
-
- `assert.equal(value1, value2)` -- checks the equality `value1 == value2`.
[edit src="pow-full" title="Open the full final example in the sandbox."]
374
+
[edit src="pow-full" title="Oтвори финалният пример в тестовата среда."]
375
375
376
-
## Summary
376
+
## Обобщение
377
377
378
-
In BDD, the spec goes first, followed by implementation. At the end we have both the spec and the code.
378
+
В BDD, спецификацията винаги е пръва, следвана от импелментацията. Накрая имаме спецификация и код към нея.
379
379
380
-
The spec can be used in three ways:
380
+
Спецификацията може да се използва по три начина:
381
381
382
-
1.As**Tests** - they guarantee that the code works correctly.
383
-
2.As**Docs** -- the titles of `describe`and`it`tell what the function does.
384
-
3.As**Examples** -- the tests are actually working examples showing how a function can be used.
382
+
1.Като**Тестове** - те гарантират, че кода работи правилно.
383
+
2.Като**Документация** -- заглавията на `describe`и`it`казват какво прави функцията.
384
+
3.Като**Примери** -- тестовете всъщност са работещи примери, които показват как да се използа функцията.
385
385
386
-
With the spec, we can safely improve, change, even rewrite the function from scratch and make sure it still works right.
386
+
Със спека ние безопасно можем да подобрим, променим или дори пренапишем функцията и тя пак да работи правилно.
387
387
388
-
That's especially important in large projects when a function is used in many places. When we change such a function, there's just no way to manually check if every place that uses it still works right.
388
+
Това е особено важно за големи проекти, където функцията се използва на много места. Когато променим такава функция, просто няма начин да проверим ръчно всички места където се използва, за да сме сигурни, че още работи правилно.
389
389
390
-
Without tests, people have two ways:
390
+
Без тестове хората имат два начина:
391
391
392
-
1.To perform the change, no matter what. And then our users meet bugs, as we probably fail to check something manually.
392
+
1.Да направят промяната въпреки всичко. И тогава нашите потребители се натъкват на бъгове, тъй като ние най-вероятно не сме успели да а проверим всичко на ръка.
393
393
2. Or, if the punishment for errors is harsh, as there are no tests, people become afraid to modify such functions, and then the code becomes outdated, no one wants to get into it. Not good for development.
394
394
395
395
**Automatic testing helps to avoid these problems!**
0 commit comments