Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port tests to mocha #416

Closed
SebastienElet opened this issue Sep 13, 2014 · 1 comment
Closed

Port tests to mocha #416

SebastienElet opened this issue Sep 13, 2014 · 1 comment

Comments

@SebastienElet
Copy link

Hello,

I propose to port the test suite to mocha.
With mocha, we could have a better debugging and code coverage.

Here is a little POC :

'use strict';

var assert = require('assert')
  , Parser = require('../lib/Parser').Parser
  , CR = '\r'
  , LF = '\n'
  , CRLF = CR + LF
;

var ss = new require('stream').Readable()
  , p
  , result = []
;
ss._read = function() {};

p = new Parser(ss);
p.on('untagged', function(info) {
  result.push(info);
});


describe('Parser', function() {
  it('QuotaRoot', function() {
    ['* QUOTAROOT INBOX ""', CRLF]
    .forEach(function(chunk) {
      ss.push(chunk);
    });
    assert.deepEqual(
      result
      , [
        {
          type: 'quotaroot'
          , num: undefined
          , textCode: undefined
          , text: {
            roots: ['']
            , mailbox: 'INBOX'
          }
        }
      ]
    );
  });
});

What do you think about this idea ?
Is there any code convention to respect ?

@mscdex
Copy link
Owner

mscdex commented Apr 3, 2015

I generally opt to do custom testing because it's less dependencies and it's easy/simple enough to do manually. Also I don't already use mocha or other testing frameworks in other projects so there is a barrier there as well.

@mscdex mscdex closed this as completed Apr 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants