package com.karateca.ddescriber.model;

import com.intellij.find.FindResult;
import com.karateca.ddescriber.BaseTestCase;

import java.util.List;

/**
 * @author Andres Dominguez.
 */
public class JasmineFinderTest extends BaseTestCase {

  public void testFindAll() throws Exception {
    List<FindResult> findResults = whenYouFindTestsForJsFile("jasmineTestBefore.js");

    // Then ensure there are 9 tests and suites.
    assertEquals(9, findResults.size());
  }

  public void testWithCaretAtTheTop() {
    List<FindResult> findResults = whenYouFindTestsForJsFile("jasmineTestCaretTop.js");

    // Then ensure there are 6 tests and suites.
    assertEquals(7, findResults.size());
  }

  private List<FindResult> whenYouFindTestsForJsFile(String fileName) {
    prepareScenarioWithTestFile(fileName);
    jasmineFinder.findAll();
    return jasmineFinder.getFindResults();
  }
}

@@ -685,16 +685,264 @@
 );%0A  %7D%0A%0A
+  public void testShouldFindTestsWithTrickyText() %7B%0A    List%3CFindResult%3E findResults = whenYouFindTestsForJsFile(%22jasmineWithWeirdRegularExpressions.js%22);%0A%0A    // Then ensure all the tests were found.%0A    assertEquals(11, findResults.size());%0A  %7D%0A%0A
   privat

add failing test