<commit_before>import { expect } from 'chai'
import Up from '../../index'
import { insideDocumentAndParagraph } from './Helpers'
import { VideoNode } from '../../SyntaxNodes/VideoNode'
import { DocumentNode } from '../../SyntaxNodes/DocumentNode'
import { PlainTextNode } from '../../SyntaxNodes/PlainTextNode'


describe('Square bracketed text starting with "video:" with a description pointing to a URL', () => {
  it('produces a video bide with the description and URL', () => {
    expect(Up.toAst('I would never stay in a house with this. [video: ghosts eating luggage -> http://example.com/poltergeists.webm] Would you?')).to.be.eql(
      insideDocumentAndParagraph([
        new PlainTextNode('I would never stay in a house with this. '),
        new VideoNode('ghosts eating luggage', 'http://example.com/poltergeists.webm'),
        new PlainTextNode(' Would you?')
      ]))
  })
})


describe('A video that is the only convention on its line', () => {
  it('is not placed inside a paragraph node, instead being placed directly inside the node that would have contained paragraph', () => {
    expect(Up.toAst('[video: ghosts eating luggage -> http://example.com/poltergeists.webm]')).to.be.eql(
      new DocumentNode([
        new VideoNode('ghosts eating luggage', 'http://example.com/poltergeists.webm')
      ]))
  })
})


describe('Parenthesized text starting with "video:" with a description pointing to a URL', () => {
  it('produces a video node', () => {
    expect(Up.toAst('(video: ghosts eating luggage -> http://example.com/poltergeists.webm)')).to.be.eql(
      new DocumentNode([
        new VideoNode('ghosts eating luggage', 'http://example.com/poltergeists.webm')
      ]))
  })
})


describe('Curly bracketed text starting with "video:" with a description pointing to a URL', () => {
  it('produces a video node', () => {
    expect(Up.toAst('{video: ghosts eating luggage -> http://example.com/poltergeists.webm}')).to.be.eql(
      new DocumentNode([
        new VideoNode('ghosts eating luggage', 'http://example.com/poltergeists.webm')
      ]))
  })
})


describe('A video with a relative URL containing spaces and no extension', () => {
  it('is parsed correctly', () => {
    expect(Up.toAst('[video: ghosts eating luggage -> ghosts eating luggage]')).to.be.eql(
      new DocumentNode([
        new VideoNode('ghosts eating luggage', 'ghosts eating luggage'),
      ]))
  })
})


describe('A video description', () => {  
  it('can contain matching square brackets', () => {
    expect(Up.toAst('[video: ghosts eating [luggage] -> http://example.com/?state=NE]')).to.be.eql(
      new DocumentNode([
        new VideoNode('ghosts eating [luggage]', 'http://example.com/?state=NE'),
      ]))
  })
  
  it('can contain nested matching square brackets', () => {
    expect(Up.toAst('[video: [ghosts [eating]] [[luggage]] -> http://example.com/?state=NE]')).to.be.eql(
      new DocumentNode([
        new VideoNode('[ghosts [eating]] [[luggage]]', 'http://example.com/?state=NE'),
      ]))
  })
})


describe('A video URL', () => {<commit_msg>Add 4 failing video tests<commit_after>import { expect } from 'chai'
import Up from '../../index'
import { insideDocumentAndParagraph } from './Helpers'
import { VideoNode } from '../../SyntaxNodes/VideoNode'
import { DocumentNode } from '../../SyntaxNodes/DocumentNode'
import { PlainTextNode } from '../../SyntaxNodes/PlainTextNode'


describe('Square bracketed text starting with "video:" with a description pointing to a URL', () => {
  it('produces a video bide with the description and URL', () => {
    expect(Up.toAst('I would never stay in a house with this. [video: ghosts eating luggage -> http://example.com/poltergeists.webm] Would you?')).to.be.eql(
      insideDocumentAndParagraph([
        new PlainTextNode('I would never stay in a house with this. '),
        new VideoNode('ghosts eating luggage', 'http://example.com/poltergeists.webm'),
        new PlainTextNode(' Would you?')
      ]))
  })
})


describe('A video that is the only convention on its line', () => {
  it('is not placed inside a paragraph node, instead being placed directly inside the node that would have contained paragraph', () => {
    expect(Up.toAst('[video: ghosts eating luggage -> http://example.com/poltergeists.webm]')).to.be.eql(
      new DocumentNode([
        new VideoNode('ghosts eating luggage', 'http://example.com/poltergeists.webm')
      ]))
  })
})


describe('Parenthesized text starting with "video:" with a description pointing to a URL', () => {
  it('produces a video node', () => {
    expect(Up.toAst('(video: ghosts eating luggage -> http://example.com/poltergeists.webm)')).to.be.eql(
      new DocumentNode([
        new VideoNode('ghosts eating luggage', 'http://example.com/poltergeists.webm')
      ]))
  })
})


describe('Curly bracketed text starting with "video:" with a description pointing to a URL', () => {
  it('produces a video node', () => {
    expect(Up.toAst('{video: ghosts eating luggage -> http://example.com/poltergeists.webm}')).to.be.eql(
      new DocumentNode([
        new VideoNode('ghosts eating luggage', 'http://example.com/poltergeists.webm')
      ]))
  })
})


describe('A video with a relative URL containing spaces and no extension', () => {
  it('is parsed correctly', () => {
    expect(Up.toAst('[video: ghosts eating luggage -> ghosts eating luggage]')).to.be.eql(
      new DocumentNode([
        new VideoNode('ghosts eating luggage', 'ghosts eating luggage'),
      ]))
  })
})


describe('A video description produced by square brackets', () => {  
  it('can contain matching square brackets', () => {
    expect(Up.toAst('[video: ghosts eating [luggage] -> http://example.com/?state=NE]')).to.be.eql(
      new DocumentNode([
        new VideoNode('ghosts eating [luggage]', 'http://example.com/?state=NE'),
      ]))
  })
  
  it('can contain nested matching square brackets', () => {
    expect(Up.toAst('[video: [ghosts [eating]] [[luggage]] -> http://example.com/?state=NE]')).to.be.eql(
      new DocumentNode([
        new VideoNode('[ghosts [eating]] [[luggage]]', 'http://example.com/?state=NE'),
      ]))
  })
})


describe('A video description produced by parentheses', () => {  
  it('can contain matching square brackets', () => {
    expect(Up.toAst('(video: ghosts eating (luggage) -> http://example.com/?state=NE)')).to.be.eql(
      new DocumentNode([
        new VideoNode('ghosts eating (luggage)', 'http://example.com/?state=NE'),
      ]))
  })
  
  it('can contain nested matching parentheses', () => {
    expect(Up.toAst('(video: (ghosts (eating)) ((luggage)) -> http://example.com/?state=NE)')).to.be.eql(
      new DocumentNode([
        new VideoNode('(ghosts (eating)) ((luggage))', 'http://example.com/?state=NE'),
      ]))
  })
})


describe('A video description produced by curly brackets', () => {  
  it('can contain matching square brackets', () => {
    expect(Up.toAst('{video: ghosts eating {luggage} -> http://example.com/?state=NE}')).to.be.eql(
      new DocumentNode([
        new VideoNode('ghosts eating {luggage}', 'http://example.com/?state=NE'),
      ]))
  })
  
  it('can contain nested matching curly brackets', () => {
    expect(Up.toAst('(video: {ghosts {eating}} {{luggage}} -> http://example.com/?state=NE}')).to.be.eql(
      new DocumentNode([
        new VideoNode('{ghosts {eating}} {{luggage}}', 'http://example.com/?state=NE'),
      ]))
  })
})


describe('A video URL', () => {
{'fraction_non_alphanumeric': 0.17739780924392198, 'fraction_numerical': 0.0001335826876836762, 'mean_word_length': 3.49130173965207, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 55, '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': '2843689', 'n_tokens_mistral': 2420, 'n_tokens_neox': 2265, 'n_words': 592}