<commit_before>require "./spec-helper"
{$, EditorView, WorkspaceView} = require 'atom'
_ = require "underscore-plus"
AutocompleteView = require '../lib/autocomplete-view'
Autocomplete = require '../lib/autocomplete'

###
  Needs to be updated to the new package
###

describe "Autocomplete", ->
  [activationPromise] = []

  beforeEach ->
    # Create a fake workspace and open a sample file
    atom.workspaceView = new WorkspaceView
    atom.workspaceView.openSync "sample.js"
    atom.workspaceView.simulateDomAttachment()

    # Set to live completion
    atom.config.set "autocomplete-plus.liveCompletion", true

    # Spy on AutocompleteView#initialize
    spyOn(AutocompleteView.prototype, "initialize").andCallThrough()

    # Activate the package
    activationPromise = atom.packages.activatePackage "autocomplete-plus"

  describe "@activate()", ->
    it "activates autocomplete and initializes AutocompleteView instances", ->
      expect(AutocompleteView.prototype.initialize).toHaveBeenCalled()
      editor = atom.workspaceView.getActiveView()

      waitsForPromise ->
        activationPromise<commit_msg>Removed old comment<commit_after>require "./spec-helper"
{$, EditorView, WorkspaceView} = require 'atom'
_ = require "underscore-plus"
AutocompleteView = require '../lib/autocomplete-view'
Autocomplete = require '../lib/autocomplete'

describe "Autocomplete", ->
  [activationPromise] = []

  beforeEach ->
    # Create a fake workspace and open a sample file
    atom.workspaceView = new WorkspaceView
    atom.workspaceView.openSync "sample.js"
    atom.workspaceView.simulateDomAttachment()

    # Set to live completion
    atom.config.set "autocomplete-plus.liveCompletion", true

    # Spy on AutocompleteView#initialize
    spyOn(AutocompleteView.prototype, "initialize").andCallThrough()

    # Activate the package
    activationPromise = atom.packages.activatePackage "autocomplete-plus"

  describe "@activate()", ->
    it "activates autocomplete and initializes AutocompleteView instances", ->
      expect(AutocompleteView.prototype.initialize).toHaveBeenCalled()
      editor = atom.workspaceView.getActiveView()

      waitsForPromise ->
        activationPromise
{'fraction_non_alphanumeric': 0.1044504995458674, 'fraction_numerical': 0.0, 'mean_word_length': 4.171361502347418, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '2203929', 'n_tokens_mistral': 626, 'n_tokens_neox': 585, 'n_words': 139}