var expect = require('chai').expect;
var parser = require('../lib/utils/parser');

describe('Messages Parser', function() {

    it('should correctly reject non betty message', function() {
        var r = parser.parse("Random message");

        expect(r).to.not.be.ok;
    });

    it('should correctly accept betty message', function() {
        var r = parser.parse("betty: Random message");

        expect(r).to.be.ok;
        expect(r.type).to.equal("unknown");
    });

    it('should correctly parse a call action', function() {
        var r = parser.parse("betty: Call +140145170479");

        expect(r).to.be.ok;
        expect(r.type).to.equal("call");
        expect(r.phone).to.equal("+140145170479");
    });

});

@@ -720,12 +720,463 @@
    %7D);%0A%0A
+    it('should correctly parse a text action', function() %7B%0A        var r = parser.parse(%22betty: Text +140145170479%22);%0A%0A        expect(r).to.be.ok;%0A        expect(r.type).to.equal(%22text%22);%0A        expect(r.phone).to.equal(%22+140145170479%22);%0A    %7D);%0A%0A    it('should correctly parse a stop action', function() %7B%0A        var r = parser.parse(%22betty: Stop this conversation%22);%0A%0A        expect(r).to.be.ok;%0A        expect(r.type).to.equal(%22stop%22);%0A    %7D);%0A%0A
 %7D);%0A

Improve parser tests