3 var assert = require('assert');
4 var duplicateChatDetector = require('../lib/duplicate-chat-detector');
5 var Promise = require('bluebird');
7 describe('duplicate-chat-detector', function() {
8 describe('integration tests #slow', function() {
9 it('should detect duplicates', function() {
10 var FIXTURE = [false, false, false, false, false, false, false, false, false, false, true];
11 var userId = Date.now();
13 return Promise.each(FIXTURE, function(expected) {
14 return duplicateChatDetector(userId, '01234567890123456789012').then(function(result) {
15 assert.strictEqual(result, expected);
20 it('should not detect non-duplicates', function() {
22 for (var i = 0; i < 100; i++) {
25 var userId = Date.now();
27 return Promise.each(FIXTURE, function(v, i) {
28 return duplicateChatDetector(userId, 'This is the text ' + i).then(function(result) {
29 assert.strictEqual(result, false);