<commit_before>---
setup:
  - skip:
      features: regex

---
"Test cat count help":
  - do:
      cat.count:
        help: true

  - match:
      $body: >
               /^  epoch      .+   \n
                   timestamp  .+   \n
                   count      .+   \n  $/

---
"Test cat count output":

  - do:
      cat.count: {}

  - match:
      $body: >
               /^  \d+  \s  \d{2}:\d{2}:\d{2}  \s  0  \s  $/

  - do:
      index:
        index:  index1
        type:   type1
        id:     1
        body:   { foo: bar }
        refresh: true

  - do:
      cat.count: {}

  - match:
      $body: >
               /^  \d+  \s  \d{2}:\d{2}:\d{2}  \s  1  \s  $/

  - do:
      index:
        index:  index2
        type:   type2
        id:     1
        body:   { foo: bar }
        refresh: true

  - do:
      cat.count:
        h: count

  - match:
      $body: >
               /^  2  \s  $/


  - do:
      cat.count:
        index: index1

  - match:
      $body: >
               /^  \d+  \s  \d{2}:\d{2}:\d{2}  \s  1  \s  $/

  - do:
      cat.count:
        index: index2
        v: true

  - match:
      $body: >
               /^  epoch  \s+  timestamp          \s+  count  \s+  \n
                   \d+    \s+  \d{2}:\d{2}:\d{2}  \s+  \d+    \s+  \n  $/

<commit_msg>[TEST] Made cat.count REST test more readable<commit_after>---
setup:
  - skip:
      features: regex

---
"Test cat count help":
  - do:
      cat.count:
        help: true

  - match:
      $body: >
               /^  epoch      .+   \n
                   timestamp  .+   \n
                   count      .+   \n  $/

---
"Test cat count output":

  - do:
      cat.count: {}

  - match:
      $body: >
               /# epoch     timestamp              count
               ^  \d+   \s  \d{2}:\d{2}:\d{2}  \s  0     \s  $/

  - do:
      index:
        index:  index1
        type:   type1
        id:     1
        body:   { foo: bar }
        refresh: true

  - do:
      cat.count: {}

  - match:
      $body: >
               /# epoch     timestamp              count
               ^  \d+   \s  \d{2}:\d{2}:\d{2}  \s  1     \s  $/

  - do:
      index:
        index:  index2
        type:   type2
        id:     1
        body:   { foo: bar }
        refresh: true

  - do:
      cat.count:
        h: count

  - match:
      $body: >
               /# count
               ^  2     \s  $/


  - do:
      cat.count:
        index: index1

  - match:
      $body: >
               /# epoch     timestamp              count
               ^  \d+   \s  \d{2}:\d{2}:\d{2}  \s  1  \s  $/

  - do:
      cat.count:
        index: index2
        v: true

  - match:
      $body: >
               /^  epoch  \s+  timestamp          \s+  count  \s+  \n
                   \d+    \s+  \d{2}:\d{2}:\d{2}  \s+  \d+    \s+  \n  $/


{'fraction_non_alphanumeric': 0.1568141592920354, 'fraction_numerical': 0.016991150442477877, 'mean_word_length': 0.7585563161169881, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4429608', 'n_tokens_mistral': 1115, 'n_tokens_neox': 1058, 'n_words': 242}