<commit_before>(ns celestial.integration.persistency.actions
 (:import clojure.lang.ExceptionInfo)
 (:require 
  [celestial.fixtures.data :refer (redis-prox-spec redis-type user-quota redis-deploy)]
  [celestial.fixtures.core :refer (is-type?)]
  [celestial.persistency :as p]
  [celestial.redis :refer (clear-all)]  
  [celestial.persistency.actions :as a])
 (:use midje.sweet))

(with-state-changes [(before :facts (clear-all))]
  (fact "basic actions usage" :integration :redis :actions
    (p/add-type redis-type) 
    (let [id (a/add-action redis-deploy)]
      (a/get-action id) => redis-deploy
      (a/get-action-index :operates-on "redis") => [(str id)]
      (a/find-action-for "deploy" "redis") => redis-deploy))

  (fact "duplicated actions" :integration :redis :actions
    (p/add-type redis-type) 
    (let [id (a/add-action redis-deploy)]
      (a/get-action id) => redis-deploy
      (a/add-action redis-deploy) => 
         (throws ExceptionInfo (is-type? :celestial.persistency.actions/duplicated-action)))))<commit_msg>fixing action tests adding provided nil<commit_after>(ns celestial.integration.persistency.actions
 (:import clojure.lang.ExceptionInfo)
 (:require 
  [celestial.fixtures.data :refer (redis-prox-spec redis-type user-quota redis-deploy)]
  [celestial.fixtures.core :refer (is-type?)]
  [celestial.persistency :as p]
  [celestial.redis :refer (clear-all)]  
  [celestial.persistency.actions :as a])
 (:use midje.sweet))

(def redis-deploy-provided (assoc redis-deploy :provided nil))
(with-state-changes [(before :facts (clear-all))]
  (fact "basic actions usage" :integration :redis :actions
    (p/add-type redis-type) 
    (let [id (a/add-action redis-deploy)]
      (a/get-action id) => redis-deploy-provided
      (a/get-action-index :operates-on "redis") => [(str id)]
      (a/find-action-for "deploy" "redis") =>  redis-deploy-provided))

  (fact "duplicated actions" :integration :redis :actions
    (p/add-type redis-type) 
    (let [id (a/add-action redis-deploy)]
      (a/get-action id) => redis-deploy-provided
      (a/add-action redis-deploy) => 
         (throws ExceptionInfo (is-type? :celestial.persistency.actions/duplicated-action)))))
{'fraction_non_alphanumeric': 0.1600547195622435, 'fraction_numerical': 0.0, 'mean_word_length': 3.8432671081677703, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '1556899', 'n_tokens_mistral': 831, 'n_tokens_neox': 769, 'n_words': 160}