<commit_before>import 'mocha'
import * as assert from 'assert'
import start from './helpers/server'

declare var browser: any

describe('auto-cookie', () => {
  let server
  const COOKIE_NAME = 'auto-cookie'

  before(() => {
    server = start()
    return server
  })

  after(() => server.close())
  beforeEach('clean cookies', () => browser.deleteCookie())

  it('should get cookie around xip.io', () =>
    browser
      .url('http://www.0.0.0.0.xip.io:8000')
      .getCookie(COOKIE_NAME)
      .then((cookie: any) => {
        assert(cookie.value === 'data')
        assert(cookie.domain === '.xip.io')
      }))

  it('should not set cookie around 0.0.0.0', () =>
    browser
      .url('http://0.0.0.0:8000')
      .getCookie(COOKIE_NAME)
      .then((cookie: any) => {
        assert(!cookie)
      }))

  it('should get cookie with path', () =>
    browser
      .url('http://www.0.0.0.0.xip.io:8000/path')
      .getCookie('path-cookie')
      .then((cookie: any) => {
        assert(cookie.value === 'setPath')
        assert(cookie.domain === '.xip.io')
      }))

  it('should get cookie has object value', () =>
    browser
      .url('http://www.0.0.0.0.xip.io:8000')
      .getCookie('object-cookie')
      .then((cookie: any) => {
        assert.deepEqual(cookie.value, { s: 'string', n: 999, b: true })
        assert(cookie.domain === '.xip.io')
      }))
})<commit_msg>refactor(test) add set data type check<commit_after>import 'mocha'
import * as assert from 'assert'
import start from './helpers/server'

declare var browser: any

describe('auto-cookie', () => {
  let server
  const COOKIE_NAME = 'auto-cookie'

  before(() => {
    server = start()
    return server
  })

  after(() => server.close())
  beforeEach('clean cookies', () => browser.deleteCookie())

  it('should get cookie around xip.io', () =>
    browser
      .url('http://www.0.0.0.0.xip.io:8000')
      .getCookie(COOKIE_NAME)
      .then((cookie: any) => {
        assert(cookie.value === 'data')
        assert(cookie.domain === '.xip.io')
      }))

  it('should not set cookie around 0.0.0.0', () =>
    browser
      .url('http://0.0.0.0:8000')
      .getCookie(COOKIE_NAME)
      .then((cookie: any) => {
        assert(!cookie)
      }))

  it('should get cookie with path', () =>
    browser
      .url('http://www.0.0.0.0.xip.io:8000/path')
      .getCookie('path-cookie')
      .then((cookie: any) => {
        assert(cookie.value === 'setPath')
        assert(cookie.domain === '.xip.io')
      }))

  it('should get cookie has object value', () =>
    browser
      .url('http://www.0.0.0.0.xip.io:8000')
      .getCookie('object-cookie')
      .then((cookie: any) => {
        assert(typeof cookie.value === 'object')
        assert(cookie.domain === '.xip.io')
      }))
})
{'fraction_non_alphanumeric': 0.20050305425799497, 'fraction_numerical': 0.026949335249730505, 'mean_word_length': 2.462686567164179, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 10, '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': '2180440', 'n_tokens_mistral': 992, 'n_tokens_neox': 938, 'n_words': 183}