Skip to content

Commit

Permalink
Add missing test for variant A in the AB test
Browse files Browse the repository at this point in the history
  • Loading branch information
richardTowers committed Oct 18, 2023
1 parent 554e09b commit 97e613f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/controllers/content_items_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,22 @@ class ContentItemsControllerTest < ActionController::TestCase
assert_match "<li>#{I18n.t('ab_tests.find_utr_number_video_links.Z')}</li>", response.body
end

test "AB test replaces content on the find-utr-number page with variant A" do
content_item = content_store_has_schema_example("answer", "answer")
content_item["base_path"] = "/find-utr-number"
content_item["details"]["body"] = "<li>{{ab_test_find_utr_number_video_links}}</li>"
content_item["locale"] = "en"

stub_content_store_has_item(content_item["base_path"], content_item)

request.headers["HTTP_GOVUK_ABTEST_FIND_UTR_NUMBER_VIDEO_LINKS"] = "A"

get :show, params: { path: path_for(content_item) }
assert_response :success
assert_no_match "{{ab_test_find_utr_number_video_links}}", response.body
assert_match "<li>#{I18n.t('ab_tests.find_utr_number_video_links.A')}</li>", response.body
end

test "AB test replaces content on the find-utr-number page with variant B" do
content_item = content_store_has_schema_example("answer", "answer")
content_item["base_path"] = "/find-utr-number"
Expand Down

0 comments on commit 97e613f

Please sign in to comment.