Sha256: e24ed71eb5275552d25a210c6becbe1b6c3828be48e6c70a92dd723b8f66ae62

Contents?: true

Size: 832 Bytes

Versions: 4

Compression:

Stored size: 832 Bytes

Contents

# frozen_string_literal: true

require 'json'
require 'yaml'

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

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

  def test_html_search_query
    result = curlyq('html', '-s', '#main article .aligncenter', '-q', 'images[0]', 'https://brettterpstra.com/2024/10/19/web-excursions-for-october-19-2024/')
    json = JSON.parse(result)

    assert_match(/aligncenter/, json[0]['class'], 'Should have found an image with class "aligncenter"')
  end

  def test_html_query
    result = curlyq('html', '-q', 'meta.title', 'https://brettterpstra.com/2024/01/10/introducing-curlyq-a-pipeline-oriented-curl-helper/')
    json = JSON.parse(result)
    assert_match(/Introducing CurlyQ/, json[0], 'Should have retrived the page title')
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
curlyq-0.0.16 test/curlyq_html_test.rb
curlyq-0.0.15 test/curlyq_html_test.rb
curlyq-0.0.14 test/curlyq_html_test.rb
curlyq-0.0.13 test/curlyq_html_test.rb