<commit_before>import { mount } from '@test'
import Workbench from '~/components/Workbench.vue'

describe('Workbench', () => {
  let wrapper, vm
  beforeEach(() => {
    wrapper = mount(Workbench, {
      // provide stubs for all children
      stubs: Object.keys(Workbench.components),
    })
    vm = wrapper.vm
  })

  describe('route guards', () => {
    it('should attempt a redirect if no sessionID/userID provided', () => {
      // stub in a mock router
      vm.$router = {
        push: sinon.spy(),
      }

      // call the route guard with the next callback
      vm.$options.beforeRouteEnter(null, null, cb => cb(vm))

      // no sessionID set on vm, so route event should have been triggered
      expect(vm.$router.push.called).to.equal(true)
    })

    it('should not attempt a redirect if a sessionID/userID is provided', () => {
      // stub in a mock router
      vm.$router = {
        push: sinon.spy(),
      }
      vm.$store.commit('setSessionID', 'test')
      vm.$store.commit('setUserID', 1)

      // call the route guard with the next callback
      vm.$options.beforeRouteEnter(null, null, cb => cb(vm))

      // no routing event expected
      expect(vm.$router.push.called).to.equal(false)<commit_msg>update api with merge<commit_after>import { mount } from '@test'
import Workbench from '~/components/Workbench.vue'

describe('Workbench', () => {
  let wrapper, vm
  beforeEach(() => {
    wrapper = mount(Workbench, {
      // provide stubs for all children
      stubs: Object.keys(Workbench.components),
    })
    vm = wrapper.vm
  })

  describe('route guards', () => {
    it('should attempt a redirect if no sessionID/userID provided', () => {
      // stub in a mock router
      vm.$router = {
        replace: sinon.spy(),
      }

      // call the route guard with the next callback
      vm.$options.beforeRouteEnter(null, null, cb => cb(vm))

      // no sessionID set on vm, so route event should have been triggered
      expect(vm.$router.push.called).to.equal(true)
    })

    it('should not attempt a redirect if a sessionID/userID is provided', () => {
      // stub in a mock router
      vm.$router = {
        push: sinon.spy(),
      }
      vm.$store.commit('setSessionID', 'test')
      vm.$store.commit('setUserID', 1)

      // call the route guard with the next callback
      vm.$options.beforeRouteEnter(null, null, cb => cb(vm))

      // no routing event expected
      expect(vm.$router.push.called).to.equal(false)
{'fraction_non_alphanumeric': 0.13820811570912012, 'fraction_numerical': 0.0008035355564483728, 'mean_word_length': 2.547008547008547, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '3211118', 'n_tokens_mistral': 746, 'n_tokens_neox': 724, 'n_words': 214}