mirror of
https://github.com/goldbergyoni/nodebestpractices.git
synced 2025-10-27 19:17:13 +08:00
@ -37,12 +37,12 @@ describe.skip('Classification des clients', () => {
|
|||||||
### Contre exemple de code : aucune séparation, un seul bloc, plus difficile à interpréter
|
### Contre exemple de code : aucune séparation, un seul bloc, plus difficile à interpréter
|
||||||
```javascript
|
```javascript
|
||||||
test('Doit être classé comme premium', () => {
|
test('Doit être classé comme premium', () => {
|
||||||
const customerToClassify = {spent:505, joined: new Date(), id:1}
|
const customerToClassify = {spent:505, joined: new Date(), id:1}
|
||||||
const DBStub = sinon.stub(dataAccess, 'getCustomer')
|
const DBStub = sinon.stub(dataAccess, 'getCustomer')
|
||||||
.reply({id:1, classification: 'ordinaire'});
|
.reply({id:1, classification: 'regular'});
|
||||||
const receivedClassification = customerClassifier.classifyCustomer(customerToClassify);
|
const receivedClassification = customerClassifier.classifyCustomer(customerToClassify);
|
||||||
expect(receivedClassification).toMatch('premium');
|
expect(receivedClassification).toMatch('premium');
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
|
|||||||
Reference in New Issue
Block a user