'use strict';

var should = require('should');
var idCard = require('../index');

describe('index.js', function() {
  context('isValid', function() {
    it('when ID is valid', function() {
      idCard.isValid('220303197807074202').should.be.eql(true);
    });

    it('when ID is not valid', function() {
      idCard.isValid('2202323').should.be.eql(false);
    });
  });

  context('query', function() {
    it('when ID is valid', function() {
      var result = idCard.query('220303197807074202');
      result.should.have.properties({
        valid: true,
        address: '吉林省四平市铁东区',
        gender: 'F',
        year: 1978,
        month: 7,
        day: 7,
        age: 37
      });
    });

    it('when ID is not valid', function() {
      var result = idCard.query('110');
      result.should.have.properties({
        valid: false
      });
    });
  });
});

@@ -861,13 +861,386 @@
 );%0A  %7D);
+%0A%0A  context('generate', function() %7B%0A    it('could return a random information whth 18 bits ID', function() %7B%0A      var result = idCard.generate();%0A      result.ID.should.have.length(18);%0A    %7D);%0A%0A    it('could return a random information whth 15 bits ID', function() %7B%0A      var result = idCard.generate(%7B bits: 15 %7D);%0A      result.ID.should.have.length(15);%0A    %7D);%0A  %7D);
 %0A%7D);%0A

add test for function generate