mirror of
https://github.com/goldbergyoni/nodebestpractices.git
synced 2025-10-29 08:37:18 +08:00
Reflecion of #589
This commit is contained in:
@ -17,8 +17,8 @@
|
|||||||
### Пример кода: имя теста, состоящее из 3 частей
|
### Пример кода: имя теста, состоящее из 3 частей
|
||||||
```javascript
|
```javascript
|
||||||
//1. unit under test
|
//1. unit under test
|
||||||
describe('Products Service', function() {
|
describe('Products Service', () => {
|
||||||
describe('Add new product', function() {
|
describe('Add new product', () => {
|
||||||
//2. scenario and 3. expectation
|
//2. scenario and 3. expectation
|
||||||
it('When no price is specified, then the product status is pending approval', () => {
|
it('When no price is specified, then the product status is pending approval', () => {
|
||||||
const newProduct = new ProductService().add(...);
|
const newProduct = new ProductService().add(...);
|
||||||
@ -32,8 +32,8 @@ describe('Products Service', function() {
|
|||||||
|
|
||||||
### Пример кода - Антипаттерн: нужно прочитать весь тестовый код, чтобы понять намерение
|
### Пример кода - Антипаттерн: нужно прочитать весь тестовый код, чтобы понять намерение
|
||||||
```javascript
|
```javascript
|
||||||
describe('Products Service', function() {
|
describe('Products Service', () => {
|
||||||
describe('Add new product', function() {
|
describe('Add new product', () => {
|
||||||
it('Should return the right status', () => {
|
it('Should return the right status', () => {
|
||||||
//hmm, what is this test checking? what are the scenario and expectation?
|
//hmm, what is this test checking? what are the scenario and expectation?
|
||||||
const newProduct = new ProductService().add(...);
|
const newProduct = new ProductService().add(...);
|
||||||
|
|||||||
Reference in New Issue
Block a user