<commit_before>require_relative "../spec_helper"

describe "Stack Changes" do
  #Test upgrading stack invalidates the cache
  it "should not restore cached directories" do
    Hatchet::Runner.new("default-node", stack: "heroku-18").deploy do |app, heroku|
      app.update_stack("heroku-16")
      run!('git commit --allow-empty -m "heroku-16 migrate"')
      app.push!
      expect(app.output).to include("Cached directories were not restored due to a change in version of node, npm, yarn or stack")
    end
  end

#Test cache for regular deploys is used on repeated deploys
  it "should not restore cache if the stack did not change" do
    Hatchet::Runner.new('default-node', stack: "heroku-16").deploy do |app, heroku|
      app.update_stack("heroku-16")
      run!('git commit --allow-empty -m "cedar migrate"')
      app.push!
      expect(app.output).to_not include("Cached directories were not restored due to a change in version of node, npm, yarn or stack")
      expect(app.output).to include("not cached - skipping")
    end
  end
end<commit_msg>make heroku-20 the current stack and heroku-18 the deprecated stack<commit_after>require_relative "../spec_helper"

describe "Stack Changes" do
  #Test upgrading stack invalidates the cache
  it "should not restore cached directories" do
    Hatchet::Runner.new("default-node", stack: "heroku-20").deploy do |app, heroku|
      app.update_stack("heroku-18")
      run!('git commit --allow-empty -m "heroku-18 migrate"')
      app.push!
      expect(app.output).to include("Cached directories were not restored due to a change in version of node, npm, yarn or stack")
    end
  end

#Test cache for regular deploys is used on repeated deploys
  it "should not restore cache if the stack did not change" do
    Hatchet::Runner.new('default-node', stack: "heroku-20").deploy do |app, heroku|
      app.update_stack("heroku-20")
      run!('git commit --allow-empty -m "cedar migrate"')
      app.push!
      expect(app.output).to_not include("Cached directories were not restored due to a change in version of node, npm, yarn or stack")
      expect(app.output).to include("not cached - skipping")
    end
  end
end
{'fraction_non_alphanumeric': 0.10967741935483871, 'fraction_numerical': 0.011059907834101382, 'mean_word_length': 3.619148936170213, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '487307', 'n_tokens_mistral': 679, 'n_tokens_neox': 635, 'n_words': 236}