# frozen_string_literal: true

require 'spec_helper'
require 'youhub/models/comment_thread'
require 'youhub/models/comment'

describe Youhub::CommentThread, :server_app do
  subject(:comment_thread) { Youhub::CommentThread.new attrs }

  context 'given an existing comment thread ID about a channel' do
    let(:attrs) { { id: 'z13kdnf4pursxnwr404cc3oz4zb0hjwirkg0k' } }

    it { expect(comment_thread.video_id).to be_nil }
    it { expect(comment_thread.total_reply_count).to be_an Integer }
    it { expect(comment_thread.can_reply?).to be false }
    it { expect(comment_thread).to be_public }

    it { expect(comment_thread.top_level_comment).to be_a Youhub::Comment }
    it { expect(comment_thread.text_display).not_to be_empty }
    it { expect(comment_thread.author_display_name).not_to be_empty }
    it { expect(comment_thread.updated_at).to be_a Time }
    it { expect(comment_thread.like_count).to be_a Integer }
  end

  context 'given an comment thread ID about a video' do
    let(:attrs) { { id: 'z134e1gyav3qt3nnr22phjeavv2zdfef0' } }
    it { expect(comment_thread.video_id).to be_a String }
  end
end
