<commit_before>require 'test_helper'
require "gds_api/test_helpers/content_store"

class RoutingTest < ActionDispatch::IntegrationTest
  include GdsApi::TestHelpers::ContentStore

  test "visiting #{Whitehall.router_prefix}/policy-topics redirects to #{Whitehall.router_prefix}/topics" do
    get "#{Whitehall.router_prefix}/policy-topics"
    assert_redirected_to "#{Whitehall.router_prefix}/topics"
  end

  test "assets are served under the #{Whitehall.router_prefix} prefix" do
    content_store_has_item('/government/publications', {})

    get publications_path
    assert_select "script[src=?]", "#{Whitehall.router_prefix}/assets/application.js"
  end

  test "visiting #{Whitehall.router_prefix} when not in frontend redirects to /" do<commit_msg>Routing integration test needs a level one taxon present<commit_after>require 'test_helper'
require "gds_api/test_helpers/content_store"

class RoutingTest < ActionDispatch::IntegrationTest
  include GdsApi::TestHelpers::ContentStore
  include TaxonomyHelper

  test "visiting #{Whitehall.router_prefix}/policy-topics redirects to #{Whitehall.router_prefix}/topics" do
    get "#{Whitehall.router_prefix}/policy-topics"
    assert_redirected_to "#{Whitehall.router_prefix}/topics"
  end

  test "assets are served under the #{Whitehall.router_prefix} prefix" do
    content_store_has_item('/government/publications', {})
    has_a_level_one_taxon

    get publications_path
    assert_select "script[src=?]", "#{Whitehall.router_prefix}/assets/application.js"
  end

  test "visiting #{Whitehall.router_prefix} when not in frontend redirects to /" do
{'fraction_non_alphanumeric': 0.10211706102117062, 'fraction_numerical': 0.0, 'mean_word_length': 5.926724137931035, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '5374269', 'n_tokens_mistral': 488, 'n_tokens_neox': 484, 'n_words': 104}