<commit_before>path = require 'path'

{$} = require 'atom'
CSON = require 'season'

PackageManager = require '../lib/package-manager'
ThemePanel = require '../lib/theme-panel'

describe "ThemePanel", ->
  [panel, packageManager] = []

  beforeEach ->
    atom.packages.loadPackage('atom-light-ui')
    atom.packages.loadPackage('atom-dark-ui')
    atom.packages.loadPackage('atom-light-syntax')
    atom.packages.loadPackage('atom-dark-syntax')
    atom.packages.packageDirPaths.push(path.join(__dirname, 'fixtures'))
    atom.themes.activatePackages()
    atom.config.set('core.themes', ['atom-dark-ui', 'atom-dark-syntax'])
    packageManager = new PackageManager
    themeMetadata = CSON.readFileSync(path.join(__dirname, 'fixtures', 'a-theme', 'package.json'))
    spyOn(packageManager, 'getAvailable').andCallFake (callback) ->
      process.nextTick -> callback(null, [themeMetadata])
    spyOn(atom.themes, 'setEnabledThemes').andCallThrough()
    panel = new ThemePanel(packageManager)

  afterEach ->
    atom.themes.deactivateThemes()

  it "selects the active syntax and UI themes", ->
    expect(panel.uiMenu.val()).toBe 'atom-dark-ui'
    expect(panel.syntaxMenu.val()).toBe 'atom-dark-syntax'
<commit_msg>Unload a-theme in an afterEach<commit_after>path = require 'path'

{$} = require 'atom'
CSON = require 'season'

PackageManager = require '../lib/package-manager'
ThemePanel = require '../lib/theme-panel'

describe "ThemePanel", ->
  [panel, packageManager] = []

  beforeEach ->
    atom.packages.loadPackage('atom-light-ui')
    atom.packages.loadPackage('atom-dark-ui')
    atom.packages.loadPackage('atom-light-syntax')
    atom.packages.loadPackage('atom-dark-syntax')
    atom.packages.packageDirPaths.push(path.join(__dirname, 'fixtures'))
    atom.themes.activatePackages()
    atom.config.set('core.themes', ['atom-dark-ui', 'atom-dark-syntax'])
    packageManager = new PackageManager
    themeMetadata = CSON.readFileSync(path.join(__dirname, 'fixtures', 'a-theme', 'package.json'))
    spyOn(packageManager, 'getAvailable').andCallFake (callback) ->
      process.nextTick -> callback(null, [themeMetadata])
    spyOn(atom.themes, 'setEnabledThemes').andCallThrough()
    panel = new ThemePanel(packageManager)

  afterEach ->
    atom.packages.unloadPackage('a-theme') if atom.packages.isPackageLoaded('a-theme')
    atom.themes.deactivateThemes()

  it "selects the active syntax and UI themes", ->
    expect(panel.uiMenu.val()).toBe 'atom-dark-ui'
    expect(panel.syntaxMenu.val()).toBe 'atom-dark-syntax'

{'fraction_non_alphanumeric': 0.15696302124311565, 'fraction_numerical': 0.0, 'mean_word_length': 4.445396145610278, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '4124233', 'n_tokens_mistral': 804, 'n_tokens_neox': 779, 'n_words': 131}