wildduck/imap-core/test/tools-test.js

23 lines
686 B
JavaScript
Raw Normal View History

2017-03-06 05:45:50 +08:00
/*eslint no-unused-expressions: 0, prefer-arrow-callback: 0 */
'use strict';
2017-06-03 14:51:58 +08:00
const imapTools = require('../lib/imap-tools');
const chai = require('chai');
const expect = chai.expect;
2017-03-06 05:45:50 +08:00
chai.config.includeStack = true;
2017-06-03 14:51:58 +08:00
describe('#packMessageRange', function() {
it('should return as is', function() {
2017-03-06 05:45:50 +08:00
expect(imapTools.packMessageRange([1, 3, 5, 9])).to.equal('1,3,5,9');
});
2017-06-03 14:51:58 +08:00
it('should return a range', function() {
2017-03-06 05:45:50 +08:00
expect(imapTools.packMessageRange([1, 2, 3, 4])).to.equal('1:4');
});
2017-06-03 14:51:58 +08:00
it('should return mixed ranges', function() {
2017-03-06 05:45:50 +08:00
expect(imapTools.packMessageRange([1, 3, 4, 6, 8, 9, 10, 11, 13])).to.equal('1,3:4,6,8:11,13');
});
});