<commit_before>const { expect } = require("chai")
const path = require("path")

const Application = require("spectron").Application

describe("ui", function () {
  this.timeout(10000)

  console.log(require("electron"), __dirname, path.join(__dirname, "..", "main.js"))

  beforeEach(function () {
    this.app = new Application({
      path: require("electron"),
      args: [path.join(__dirname, "..", "main.js")]
    })
    return this.app.start()
  })

  afterEach(function () {
    if (this.app && this.app.isRunning()) {
      return this.app.stop()
    }
  })

  it("shows an initial window", function() {
    return this.app.client.getWindowCount().then(function(windowCount) {
      expect(windowCount).to.equal(1)
    })
  })

  it("tab navigation works", function() {
    this.app.webContents.on("did-finish-load", function(event) {
      let client = this.app.client
      client.element(".header_nav a:nth-child(2)").click()
      let classesFirst = client.getAttribute(".content-container .content:nth-of-type(1)", "class").split(" ")
      let classesSecond = client.getAttribute(".content-container .content:nth-of-type(2)", "class").split(" ")
      expect(classesFirst).to.not.include("current")
      expect(classesFirst).to.include("left")
      expect(classesSecond).to.not.include("right")
      expect(classesSecond).to.include("current")
    })
  })
})<commit_msg>Make the tab nav test actually test something<commit_after>const { expect } = require("chai")
const path = require("path")

const Application = require("spectron").Application

describe("ui", function() {
  this.timeout(10000)

  console.log(require("electron"), __dirname, path.join(__dirname, "..", "main.js"))

  beforeEach(function() {
    this.app = new Application({
      path: require("electron"),
      args: [path.join(__dirname, "..", "main.js")]
    })
    return this.app.start()
  })

  afterEach(function() {
    if (this.app && this.app.isRunning()) {
      return this.app.stop()
    }
  })

  it("should show an initial window", function() {
    return this.app.client.getWindowCount().then(function(windowCount) {
      expect(windowCount).to.equal(1)
    })
  })

  it("tab navigation should work", function(done) {
    let client = this.app.client;

    client.element(".header_nav a:nth-child(2)").click()
    client.getAttribute(".content-container .content:nth-of-type(1)", "class").then(classesFirstStr => {
      var classesFirst = classesFirstStr.split(" ")
      client.getAttribute(".content-container .content:nth-of-type(2)", "class").then(classesSecondStr => {
        var classesSecond = classesSecondStr.split(" ")

        expect(classesFirst).to.not.include("current")
        expect(classesFirst).to.include("left")
        expect(classesSecond).to.not.include("right")
        expect(classesSecond).to.include("current")
        done()
      })
    })

  })
})
{'fraction_non_alphanumeric': 0.17844767844767845, 'fraction_numerical': 0.006237006237006237, 'mean_word_length': 3.6118210862619806, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2515438', 'n_tokens_mistral': 894, 'n_tokens_neox': 866, 'n_words': 142}