test/unit/customer.js   A
last analyzed

Complexity

Total Complexity 5
Complexity/F 1

Size

Lines of Code 25
Function Count 5

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 0
c 1
b 0
f 0
nc 1
dl 0
loc 25
rs 10
wmc 5
mnd 0
bc 5
fnc 5
bpm 1
cpm 1
noi 2

1 Function

Rating   Name   Duplication   Size   Complexity  
A customer.js ➔ describe(ꞌUnit Test Customer Modelꞌ) 0 19 1
1
'use strict'
2
var mongoose = require('mongoose')
3
var Customer = mongoose.model('Customer')
4
var chai = require('chai')
5
var expect = chai.expect
6
7
describe('Unit Test Customer Model', function () {
8
  it('should be invalid if name is empty', function (done) {
9
    var customer = new Customer()
10
11
    customer.validate(function (err) {
12
      expect(err.errors.name).to.exist
0 ignored issues
show
introduced by
The result of the property access to expect(err.errors.name).to.exist is not used.
Loading history...
13
      done()
14
    })
15
  })
16
17
  it('should be valid if it has a name', function (done) {
18
    var customer = new Customer({ name: 'Neil Grogan' })
19
20
    customer.validate(function (err) {
21
      expect(err).to.not.exist
0 ignored issues
show
introduced by
The result of the property access to expect(err).to.not.exist is not used.
Loading history...
22
      done()
23
    })
24
  })
25
})
26