<commit_before>import { expect } from 'chai'
import Up from'../../../index'
import { insideDocumentAndParagraph } from'.././Helpers'
import { LinkNode } from'../../../SyntaxNodes/LinkNode'
import { PlainTextNode } from'../../../SyntaxNodes/PlainTextNode'
import { EmphasisNode } from'../../../SyntaxNodes/EmphasisNode'
import { StressNode } from'../../../SyntaxNodes/StressNode'
import { RevisionInsertionNode } from'../../../SyntaxNodes/RevisionInsertionNode'
import { RevisionDeletionNode } from'../../../SyntaxNodes/RevisionDeletionNode'
import { InlineSpoilerNode } from'../../../SyntaxNodes/InlineSpoilerNode'
import { InlineNsflNode } from'../../../SyntaxNodes/InlineNsflNode'
import { InlineNsfwNode } from'../../../SyntaxNodes/InlineNsfwNode'
import { ParenthesizedNode } from'../../../SyntaxNodes/ParenthesizedNode'
import { SquareBracketedNode } from'../../../SyntaxNodes/SquareBracketedNode'
import { HighlightNode } from'../../../SyntaxNodes/HighlightNode'


context('When most otherwise-nested conventions overlap by only their start delimiters, they nest without being split.', () => {
  context('This includes:', () => {
    specify('Two "freely-splittable" conventions (e.g. stress, revision insertion) overlap a third (e.g. revision deletion)', () => {
      expect(Up.toAst('**++~~Hello++ good** friend!~~ Hi!')).to.be.eql(
        insideDocumentAndParagraph([
          new RevisionDeletionNode([
            new StressNode([
              new RevisionInsertionNode([
                new PlainTextNode('Hello')
              ]),
              new PlainTextNode(' good')
            ]),
            new PlainTextNode(' friend!')
          ]),
          new PlainTextNode(' Hi!')
        ]))
    })

    specify('Two "only-split-when-necessary" conventions (e.g. NSFL, link) overlapping a third (e.g. spoiler)', () => {
      expect(Up.toAst('[NSFL: {(SPOILER: thwomp}(example.com) good] friend!) Hi!')).to.be.eql(
        insideDocumentAndParagraph([
          new InlineSpoilerNode([
            new InlineNsflNode([
              new LinkNode([
                new PlainTextNode('thwomp')
              ], 'https://example.com'),
              new PlainTextNode(' good')
            ]),
            new PlainTextNode(' friend!')
          ]),
          new PlainTextNode(' Hi!')
        ]))
    })

    specify('Revision deletion and revision insertion', () => {
      expect(Up.toAst('~~++Oh~~ why would you do this?++')).to.be.eql(<commit_msg>Fix/pass test<commit_after>import { expect } from 'chai'
import Up from'../../../index'
import { insideDocumentAndParagraph } from'.././Helpers'
import { LinkNode } from'../../../SyntaxNodes/LinkNode'
import { PlainTextNode } from'../../../SyntaxNodes/PlainTextNode'
import { EmphasisNode } from'../../../SyntaxNodes/EmphasisNode'
import { StressNode } from'../../../SyntaxNodes/StressNode'
import { RevisionInsertionNode } from'../../../SyntaxNodes/RevisionInsertionNode'
import { RevisionDeletionNode } from'../../../SyntaxNodes/RevisionDeletionNode'
import { InlineSpoilerNode } from'../../../SyntaxNodes/InlineSpoilerNode'
import { InlineNsflNode } from'../../../SyntaxNodes/InlineNsflNode'
import { InlineNsfwNode } from'../../../SyntaxNodes/InlineNsfwNode'
import { ParenthesizedNode } from'../../../SyntaxNodes/ParenthesizedNode'
import { SquareBracketedNode } from'../../../SyntaxNodes/SquareBracketedNode'
import { HighlightNode } from'../../../SyntaxNodes/HighlightNode'


context('When most otherwise-nested conventions overlap by only their start delimiters, they nest without being split.', () => {
  context('This includes:', () => {
    specify('Two "freely-splittable" conventions (e.g. stress, revision insertion) overlap a third (e.g. revision deletion)', () => {
      expect(Up.toAst('**++~~Hello++ good** friend!~~ Hi!')).to.be.eql(
        insideDocumentAndParagraph([
          new RevisionDeletionNode([
            new StressNode([
              new RevisionInsertionNode([
                new PlainTextNode('Hello')
              ]),
              new PlainTextNode(' good')
            ]),
            new PlainTextNode(' friend!')
          ]),
          new PlainTextNode(' Hi!')
        ]))
    })

    specify('Two "only-split-when-necessary" conventions (e.g. NSFL, link) overlapping a freely-splittable convention (e.g. stress)', () => {
      expect(Up.toAst('[NSFL: (**Ash)(example.com) is] a friend!** Hi!')).to.be.eql(
        insideDocumentAndParagraph([
          new StressNode([
            new InlineNsflNode([
              new LinkNode([
                new PlainTextNode('Ash')
              ], 'https://example.com'),
              new PlainTextNode(' is')
            ]),
            new PlainTextNode(' a friend!')
          ]),
          new PlainTextNode(' Hi!')
        ]))
    })

    specify('Revision deletion and revision insertion', () => {
      expect(Up.toAst('~~++Oh~~ why would you do this?++')).to.be.eql(
{'fraction_non_alphanumeric': 0.17335766423357665, 'fraction_numerical': 0.0, 'mean_word_length': 2.585029069767442, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 2, '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': '366086', 'n_tokens_mistral': 1462, 'n_tokens_neox': 1388, 'n_words': 292}