import test from 'ava';
import 'babel-core/register';

import AnalyzerResult from '../src/lib/analyzer-result';

test('addMessage adds expected message', t => {
  const testMessageType = 'test';
  const testMessageText = 'test-message';
  const result = new AnalyzerResult();

  result.addMessage(testMessageType, testMessageText);

  t.is(result.getMessage(testMessageType).text, testMessageText);

  // TODO: Add tests for line and column after changing what getMessage returns
});

test('getMessage returns null if message type does not exist', t => {
  const result = new AnalyzerResult();

  const message = result.getMessage('does-not-exist');

  t.is(message, null);
});

test('getMessage returns expected message text if it exists', t => {
  const testMessageType = 'test';
  const testMessageText = 'test-message';

  const result = new AnalyzerResult();
  result.addMessage(testMessageType, testMessageText);

  const messageText = result.getMessage(testMessageType).text;

  t.is(messageText, testMessageText);
});

@@ -396,88 +396,602 @@
 t);%0A
-%0A  // TODO: Add tests for line and column after changing what getMessage returns
+%7D);%0A%0Atest('addMessage adds expected line', t =%3E %7B%0A  const testMessageType = 'test';%0A  const testMessageLine = 3;%0A  const result = new AnalyzerResult();%0A%0A  result.addMessage(testMessageType, 'test-message', testMessageLine);%0A%0A  t.is(result.getMessage(testMessageType).line, testMessageLine);%0A%7D);%0A%0Atest('addMessage adds expected column', t =%3E %7B%0A  const testMessageType = 'test';%0A  const testMessageColumn = 7;%0A  const result = new AnalyzerResult();%0A%0A  result.addMessage(testMessageType, 'test-message', 3, testMessageColumn);%0A%0A  t.is(result.getMessage(testMessageType).column, testMessageColumn);
 %0A%7D);

Add tests to implement TODO comment