<commit_before># frozen_string_literal: true

require 'test_helper'

module Shopify
  class AfterAuthenticateJob < ActiveJob::Base
    def perform; end
  end
end

module ShopifyApp
  class CallbackControllerTest < ActionController::TestCase
    TEST_SHOPIFY_DOMAIN = "shop.myshopify.com"
    TEST_ASSOCIATED_USER = { "shopify_user_id" => 'test-shopify-user' }
    TEST_SESSION = "this.is.a.user.session"

    setup do
      @routes = ShopifyApp::Engine.routes
      ShopifyApp.configuration = nil
      ShopifyApp.configuration.embedded_app = true

      I18n.locale = :en

      request.env['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6)'\
                                       'AppleWebKit/537.36 (KHTML, like Gecko)'\
                                       'Chrome/69.0.3497.100 Safari/537.36'
    end

    test '#callback flashes error when omniauth is not present' do
      get :callback, params: { shop: 'shop' }
      assert_equal flash[:error], 'Could not log in to Shopify store'
    end

    test '#callback flashes error in Spanish' do
      I18n.locale = :es
      get :callback, params: { shop: 'shop' }
      assert_match 'sesión', flash[:error]
    end<commit_msg>Correct data shape<commit_after># frozen_string_literal: true

require 'test_helper'

module Shopify
  class AfterAuthenticateJob < ActiveJob::Base
    def perform; end
  end
end

module ShopifyApp
  class CallbackControllerTest < ActionController::TestCase
    TEST_SHOPIFY_DOMAIN = "shop.myshopify.com"
    TEST_ASSOCIATED_USER = { 'id' => 'test-shopify-user' }
    TEST_SESSION = "this.is.a.user.session"

    setup do
      @routes = ShopifyApp::Engine.routes
      ShopifyApp.configuration = nil
      ShopifyApp.configuration.embedded_app = true

      I18n.locale = :en

      request.env['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6)'\
                                       'AppleWebKit/537.36 (KHTML, like Gecko)'\
                                       'Chrome/69.0.3497.100 Safari/537.36'
    end

    test '#callback flashes error when omniauth is not present' do
      get :callback, params: { shop: 'shop' }
      assert_equal flash[:error], 'Could not log in to Shopify store'
    end

    test '#callback flashes error in Spanish' do
      I18n.locale = :es
      get :callback, params: { shop: 'shop' }
      assert_match 'sesión', flash[:error]
    end
{'fraction_non_alphanumeric': 0.097581317764804, 'fraction_numerical': 0.02585487906588824, 'mean_word_length': 2.607518796992481, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2757187', 'n_tokens_mistral': 803, 'n_tokens_neox': 747, 'n_words': 191}