Sha256: ed60b030ac239619cab74e57a8895f5f456403caa15e71053efec81fdc8719a1

Contents?: true

Size: 962 Bytes

Versions: 7

Compression:

Stored size: 962 Bytes

Contents

# frozen_string_literal: true

require 'json'
require 'yaml'

require 'helpers/curlyq-helpers'
require 'test_helper'

# Tests for tags command
class CurlyQHeadlinksTest < Test::Unit::TestCase
  include CurlyQHelpers

  def setup
  end

  def test_headlinks_query
    result = curlyq('headlinks', '-q', '[rel=stylesheet]', 'https://brettterpstra.com')
    json = JSON.parse(result)

    assert_equal(Array, json.class, 'Result should be an array')
    assert_match(/stylesheet/, json[0]['rel'], 'Should have retrieved a single result with rel stylesheet')
    assert_match(/screen\.\d+\.css$/, json[0]['href'], 'Stylesheet should be correct primary stylesheet')
  end

  def test_headlinks
    result = curlyq('headlinks', 'https://brettterpstra.com')
    json = JSON.parse(result)

    assert_equal(Array, json.class, 'Should have an array of results')
    assert(json.count > 1, 'Should have more than one link')
    # assert(json[0].count.positive?)
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
curlyq-0.0.16 test/curlyq_headlinks_test.rb
curlyq-0.0.15 test/curlyq_headlinks_test.rb
curlyq-0.0.14 test/curlyq_headlinks_test.rb
curlyq-0.0.13 test/curlyq_headlinks_test.rb
curlyq-0.0.12 test/curlyq_headlinks_test.rb
curlyq-0.0.11 test/curlyq_headlinks_test.rb
curlyq-0.0.10 test/curlyq_headlinks_test.rb