<commit_before>const selectors = require('../../../../selectors')
const { assertBreadcrumbs } = require('../../support/assertions')

describe('Delete company list page', () => {
  beforeEach(function () {
    Cypress.Cookies.preserveOnce('datahub.sid')
  })

  context('when viewing "Delete company list"', () => {
    before(() => {
      cy.visit('/company-lists/2a8fb06f-2099-44d6-b404-e0fae0b9ea59/delete')
    })

    it('displays breadcrumbs', () => {
      assertBreadcrumbs({
        'Home': '/',
        'Edit my company lists': '/company-lists',
        'Delete list': null,
      })
    })

    it('displays the "Delete list" heading', () => {
      cy.get(selectors.localHeader().heading).should('have.text', 'Delete list')
    })

    it('displays the list name', () => {
      cy.get(selectors.companyList.delete.insetListItem.byIndex(1))
        .should('have.text', 'A list with multiple items')
    })

    it('displays the number of companies on the list', () => {
      cy.get(selectors.companyList.delete.insetListItem.byIndex(2))
        .should('have.text', '13 companies')
    })

    it('displays the "Delete list" button', () => {
      cy.get(selectors.companyList.delete.deleteButton).should('have.text', 'Delete list')
    })

    it('displays the "Return without deleting" link', () => {
      cy.get(selectors.companyList.delete.returnAnchor).should('have.text', 'Return without deleting')
    })
  })

  context('after clicking the "Delete list" button', () => {
    before(() => {
      cy.visit('/company-lists/2a8fb06f-2099-44d6-b404-e0fae0b9ea59/delete')
      cy.get(selectors.companyList.delete.deleteButton).click()
    })

    it('redirects to the edit company lists page', () => {
      cy.location().should((loc) => {
        expect(loc.origin).to.eq(Cypress.config().baseUrl)
        expect(loc.pathname).to.eq('/company-lists')
      })
    })

    it('displays the "List deleted" flash message', () => {
      cy.get(selectors.localHeader().flash).should('contain.text', 'List deleted')
    })
  })

  context('when there is an error deleting the list', () => {
    before(() => {
      cy.visit('/company-lists/0b89bb58-2769-4783-bb2f-7a22bb566473/delete')
      cy.get(selectors.companyList.delete.deleteButton).click()
    })

    it('displays the "List deleted" flash message', () => {
      cy.get(selectors.companyList.delete.errorHeader).should('have.text', 'There was an error deleting this list')
    })
  })
<commit_msg>Update test to reflect new re-direct<commit_after>const selectors = require('../../../../selectors')
const { assertBreadcrumbs } = require('../../support/assertions')

describe('Delete company list page', () => {
  beforeEach(function () {
    Cypress.Cookies.preserveOnce('datahub.sid')
  })

  context('when viewing "Delete company list"', () => {
    before(() => {
      cy.visit('/company-lists/2a8fb06f-2099-44d6-b404-e0fae0b9ea59/delete')
    })

    it('displays breadcrumbs', () => {
      assertBreadcrumbs({
        'Home': '/',
        'Edit my company lists': '/company-lists',
        'Delete list': null,
      })
    })

    it('displays the "Delete list" heading', () => {
      cy.get(selectors.localHeader().heading).should('have.text', 'Delete list')
    })

    it('displays the list name', () => {
      cy.get(selectors.companyList.delete.insetListItem.byIndex(1))
        .should('have.text', 'A list with multiple items')
    })

    it('displays the number of companies on the list', () => {
      cy.get(selectors.companyList.delete.insetListItem.byIndex(2))
        .should('have.text', '13 companies')
    })

    it('displays the "Delete list" button', () => {
      cy.get(selectors.companyList.delete.deleteButton).should('have.text', 'Delete list')
    })

    it('displays the "Return without deleting" link', () => {
      cy.get(selectors.companyList.delete.returnAnchor).should('have.text', 'Return without deleting')
    })
  })

  context('after clicking the "Delete list" button', () => {
    before(() => {
      cy.visit('/company-lists/2a8fb06f-2099-44d6-b404-e0fae0b9ea59/delete')
      cy.get(selectors.companyList.delete.deleteButton).click()
    })

    it('redirects to the edit company lists page', () => {
      cy.location().should((loc) => {
        expect(loc.origin).to.eq(Cypress.config().baseUrl)
        expect(loc.pathname).to.eq('/')
      })
    })

    it('displays the "List deleted" flash message', () => {
      cy.get(selectors.localHeader().flash).should('contain.text', 'List deleted')
    })
  })

  context('when there is an error deleting the list', () => {
    before(() => {
      cy.visit('/company-lists/0b89bb58-2769-4783-bb2f-7a22bb566473/delete')
      cy.get(selectors.companyList.delete.deleteButton).click()
    })

    it('displays the "List deleted" flash message', () => {
      cy.get(selectors.companyList.delete.errorHeader).should('have.text', 'There was an error deleting this list')
    })
  })

{'fraction_non_alphanumeric': 0.1827349737797499, 'fraction_numerical': 0.026220250100847116, 'mean_word_length': 3.0983471074380167, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 37, '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': '7389383', 'n_tokens_mistral': 1681, 'n_tokens_neox': 1580, 'n_words': 271}