<commit_before>import { expect } from 'chai'
import Up from '../../../index'
import { insideDocumentAndParagraph } from '../Helpers'
import { DocumentNode } from '../../../SyntaxNodes/DocumentNode'
import { ParagraphNode } from '../../../SyntaxNodes/ParagraphNode'
import { PlainTextNode } from '../../../SyntaxNodes/PlainTextNode'
import { InlineSpoilerNode } from '../../../SyntaxNodes/InlineSpoilerNode'
import { InlineNsfwNode } from '../../../SyntaxNodes/InlineNsfwNode'
import { InlineNsflNode } from '../../../SyntaxNodes/InlineNsflNode'
import { AudioNode } from '../../../SyntaxNodes/AudioNode'
import { FootnoteNode } from '../../../SyntaxNodes/FootnoteNode'
import { FootnoteBlockNode } from '../../../SyntaxNodes/FootnoteBlockNode'


context("When the custom term for an inline convention starts with a caret, the fact that it happens to start with the start delimiter for footnotes doesn't affect anything.", () => {
  context("When the custom term for 'spoiler' starts with a caret", () => {
    const up = new Up({
      i18n: {
        terms: { spoiler: '^lookaway^' }
      }
    })

    specify('inline spoilers can be produced using the term', () => {
      expect(up.toAst('[^lookaway^: Ash fights Gary]')).to.be.eql(
        insideDocumentAndParagraph([
          new InlineSpoilerNode([
            new PlainTextNode('Ash fights Gary')
          ])
        ]))
    })

    specify('an unmatched inline spoiler start delimiter is treated as plain text', () => {
      expect(up.toAst('[^lookaway^: Not finished typi')).to.be.eql(
        insideDocumentAndParagraph([
          new PlainTextNode('[^lookaway^: Not finished typi')
        ]))
    })
  })


  context("When the custom term for 'nsfw' starts with a caret", () => {
    const up = new Up({
      i18n: {
        terms: { nsfw: '^lookaway^' }
      }
    })

    specify('inline NSFW conventions can be produced using the term', () => {
      expect(up.toAst('[^lookaway^: Ash fights Gary]')).to.be.eql(
        insideDocumentAndParagraph([
          new InlineNsfwNode([
            new PlainTextNode('Ash fights Gary')
          ])
        ]))
    })

    specify('an unmatched inline NSFW start delimiter is treated as plain text', () => {
      expect(up.toAst('[^lookaway^: Not finished typi')).to.be.eql(
        insideDocumentAndParagraph([
          new PlainTextNode('[^lookaway^: Not finished typi')
        ]))
    })
  })


  context("When the custom term for 'nsfl' starts with a caret", () => {
    const up = new Up({
      i18n: {
        terms: { nsfl: '^lookaway^' }
      }
    })

    specify('inline NSFL conventions can be produced using the term', () => {
      expect(up.toAst('[^lookaway^: Ash fights Gary]')).to.be.eql(
        insideDocumentAndParagraph([
          new InlineNsflNode([
            new PlainTextNode('Ash fights Gary')
          ])
        ]))
    })

    specify('an unmatched inline NSFL start delimiter is treated as plain text', () => {
      expect(up.toAst('[^lookaway^: Not finished typi')).to.be.eql(
        insideDocumentAndParagraph([
          new PlainTextNode('[^lookaway^: Not finished typi')
        ]))
    })
  })


  context("When the custom term for 'audio' starts with a caret", () => {
    const up = new Up({
      i18n: {
        terms: { audio: '^listen^' }
      }
    })

    specify('audio conventions can be produced using the term', () => {
      expect(up.toAst('[^listen^: Ash fights Gary](example.com/audio.ogg)')).to.be.eql(
        new DocumentNode([
          new AudioNode('Ash fights Gary', 'https://example.com/audio.ogg')
        ]))
    })

    specify('an unmatched audio start delimiter is treated as plain text', () => {
      expect(up.toAst('[^listen^: Ash fights Ga')).to.be.eql(
        insideDocumentAndParagraph([
          new PlainTextNode('[^listen^: Ash fights Ga')
        ]))
    })

    specify('a would-be audio convention without its bracketed URL produces a footnote instead', () => {
      const footnote = new FootnoteNode([
        new PlainTextNode('listen^: I guess this means "listen up"?')
      ], 1)

      expect(up.toAst('[^listen^: I guess this means "listen up"?]')).to.be.eql(
        new DocumentNode([
          new ParagraphNode([footnote]),
          new FootnoteBlockNode([footnote])
        ]))
    })
  })
})<commit_msg>Add 3 passing config tests<commit_after>import { expect } from 'chai'
import Up from '../../../index'
import { insideDocumentAndParagraph } from '../Helpers'
import { DocumentNode } from '../../../SyntaxNodes/DocumentNode'
import { ParagraphNode } from '../../../SyntaxNodes/ParagraphNode'
import { PlainTextNode } from '../../../SyntaxNodes/PlainTextNode'
import { InlineSpoilerNode } from '../../../SyntaxNodes/InlineSpoilerNode'
import { InlineNsfwNode } from '../../../SyntaxNodes/InlineNsfwNode'
import { InlineNsflNode } from '../../../SyntaxNodes/InlineNsflNode'
import { AudioNode } from '../../../SyntaxNodes/AudioNode'
import { ImageNode } from '../../../SyntaxNodes/ImageNode'
import { FootnoteNode } from '../../../SyntaxNodes/FootnoteNode'
import { FootnoteBlockNode } from '../../../SyntaxNodes/FootnoteBlockNode'


context("When the custom term for an inline convention starts with a caret, the fact that it happens to start with the start delimiter for footnotes doesn't affect anything.", () => {
  context("When the custom term for 'spoiler' starts with a caret", () => {
    const up = new Up({
      i18n: {
        terms: { spoiler: '^lookaway^' }
      }
    })

    specify('inline spoilers can be produced using the term', () => {
      expect(up.toAst('[^lookaway^: Ash fights Gary]')).to.be.eql(
        insideDocumentAndParagraph([
          new InlineSpoilerNode([
            new PlainTextNode('Ash fights Gary')
          ])
        ]))
    })

    specify('an unmatched inline spoiler start delimiter is treated as plain text', () => {
      expect(up.toAst('[^lookaway^: Not finished typi')).to.be.eql(
        insideDocumentAndParagraph([
          new PlainTextNode('[^lookaway^: Not finished typi')
        ]))
    })
  })


  context("When the custom term for 'nsfw' starts with a caret", () => {
    const up = new Up({
      i18n: {
        terms: { nsfw: '^lookaway^' }
      }
    })

    specify('inline NSFW conventions can be produced using the term', () => {
      expect(up.toAst('[^lookaway^: Ash fights Gary]')).to.be.eql(
        insideDocumentAndParagraph([
          new InlineNsfwNode([
            new PlainTextNode('Ash fights Gary')
          ])
        ]))
    })

    specify('an unmatched inline NSFW start delimiter is treated as plain text', () => {
      expect(up.toAst('[^lookaway^: Not finished typi')).to.be.eql(
        insideDocumentAndParagraph([
          new PlainTextNode('[^lookaway^: Not finished typi')
        ]))
    })
  })


  context("When the custom term for 'nsfl' starts with a caret", () => {
    const up = new Up({
      i18n: {
        terms: { nsfl: '^lookaway^' }
      }
    })

    specify('inline NSFL conventions can be produced using the term', () => {
      expect(up.toAst('[^lookaway^: Ash fights Gary]')).to.be.eql(
        insideDocumentAndParagraph([
          new InlineNsflNode([
            new PlainTextNode('Ash fights Gary')
          ])
        ]))
    })

    specify('an unmatched inline NSFL start delimiter is treated as plain text', () => {
      expect(up.toAst('[^lookaway^: Not finished typi')).to.be.eql(
        insideDocumentAndParagraph([
          new PlainTextNode('[^lookaway^: Not finished typi')
        ]))
    })
  })


  context("When the custom term for 'audio' starts with a caret", () => {
    const up = new Up({
      i18n: {
        terms: { audio: '^listen^' }
      }
    })

    specify('audio conventions can be produced using the term', () => {
      expect(up.toAst('[^listen^: Ash fights Gary](example.com/audio.ogg)')).to.be.eql(
        new DocumentNode([
          new AudioNode('Ash fights Gary', 'https://example.com/audio.ogg')
        ]))
    })

    specify('an unmatched audio start delimiter is treated as plain text', () => {
      expect(up.toAst('[^listen^: Ash fights Ga')).to.be.eql(
        insideDocumentAndParagraph([
          new PlainTextNode('[^listen^: Ash fights Ga')
        ]))
    })

    specify('a would-be audio convention without its bracketed URL produces a footnote instead', () => {
      const footnote = new FootnoteNode([
        new PlainTextNode('listen^: I guess this means "listen up"?')
      ], 1)

      expect(up.toAst('[^listen^: I guess this means "listen up"?]')).to.be.eql(
        new DocumentNode([
          new ParagraphNode([footnote]),
          new FootnoteBlockNode([footnote])
        ]))
    })
  })


  context("When the custom term for 'image' starts with a caret", () => {
    const up = new Up({
      i18n: {
        terms: { image: '^look^' }
      }
    })

    specify('audio conventions can be produced using the term', () => {
      expect(up.toAst('[^look^: Ash fights Gary](example.com/audio.ogg)')).to.be.eql(
        new DocumentNode([
          new ImageNode('Ash fights Gary', 'https://example.com/audio.ogg')
        ]))
    })

    specify('an unmatched image start delimiter is treated as plain text', () => {
      expect(up.toAst('[^look^: Ash fights Ga')).to.be.eql(
        insideDocumentAndParagraph([
          new PlainTextNode('[^look^: Ash fights Ga')
        ]))
    })

    specify('a would-be image convention without its bracketed URL produces a footnote instead', () => {
      const footnote = new FootnoteNode([
        new PlainTextNode('look^: I guess this means "look up"?')
      ], 1)

      expect(up.toAst('[^look^: I guess this means "look up"?]')).to.be.eql(
        new DocumentNode([
          new ParagraphNode([footnote]),
          new FootnoteBlockNode([footnote])
        ]))
    })
  })
})
{'fraction_non_alphanumeric': 0.15468829194120629, 'fraction_numerical': 0.002230106436898125, 'mean_word_length': 2.554034582132565, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 35, 'https://': 3, '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': '4331531', 'n_tokens_mistral': 3009, 'n_tokens_neox': 2898, 'n_words': 797}