<commit_before>require 'spec_helper'
require 'app/components/uploader'

describe Playground::UploaderComponent do
  subject(:uploader) { Wedge[:uploader] }

  html Wedge.html! { button 'Upload' }

  context '#display' do
    subject { uploader.display }

    if Wedge.server?
      it { is_expected.to be_a Wedge::DOM }
    else
      it { is_expected.to be_nil }
    end
  end

  context 'browser_events' do
    before do
      # stub store settings
      Wedge::Plugins::Uploader.any_instance.stub(:settings).and_return({
        aws_access_key_id: 123456,
        bucket: 'wedge'
      })
      uploader.trigger :browser_events
    end

    it 'should' do
      puts 'here'
    end
  end if Wedge.client?
end<commit_msg>uploader test<commit_after>require 'spec_helper'
require 'app/components/uploader'

describe Playground::UploaderComponent do
  subject(:uploader) { Wedge[:uploader] }

  html Wedge.html! { button 'Upload' }.to_html

  context '#display' do
    subject { uploader.display }

    if Wedge.server?
      it { is_expected.to be_a Wedge::DOM }
    else
      it { is_expected.to be_nil }
    end
  end

  context 'browser_events' do
    # https://github.com/opal/opal-rspec/issues/20
    # Stubbing doesn't working in opal-rspec so we have to do this
    Wedge::Plugins::Uploader.instance_eval do
      def settings
        { aws_access_key_id: 123456, bucket: 'wedge' }
      end
    end

    before { uploader.trigger :browser_events }

    it 'should have fine uploader button' do
      expect(uploader.dom.find('.qq-uploader').to_html).not_to be_empty
    end
  end if Wedge.client?
end
{'fraction_non_alphanumeric': 0.09944064636420137, 'fraction_numerical': 0.00870105655686762, 'mean_word_length': 2.9950372208436726, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, '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': '3808876', 'n_tokens_mistral': 550, 'n_tokens_neox': 527, 'n_words': 129}