Skip to content

Commit

Permalink
Remove unnecessary test helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
start committed Sep 24, 2020
1 parent 1daed06 commit 8313014
Show file tree
Hide file tree
Showing 15 changed files with 18 additions and 37 deletions.
3 changes: 1 addition & 2 deletions src/Test/FiddlingWithSyntaxTree/Document.create.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { expect } from 'chai'
import * as Up from '../../Main'
import { cast } from '../Helpers'


const NOT_USED = cast<string>(null)
const NOT_USED: string = null!

context('The `Document.create` method is automatically used during the normal parsing process. It returns a document object with:', () => {
specify('A table of contents', () => {
Expand Down
4 changes: 0 additions & 4 deletions src/Test/Helpers.ts

This file was deleted.

3 changes: 1 addition & 2 deletions src/Test/Html/Escaping/AttributeValue.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { expect } from 'chai'
import * as Up from '../../../Main'
import { cast } from '../../Helpers'


context('Within any attribute value, all instances of " and & are escaped. Specifically, within the', () => {
Expand Down Expand Up @@ -186,7 +185,7 @@ context('Within any attribute value, all instances of " and & are escaped. Speci
}
})

const NOT_USED = cast<string>(null)
const NOT_USED: string = null!

const heading =
new Up.Heading([new Up.Text('I enjoy apples')], {
Expand Down
3 changes: 1 addition & 2 deletions src/Test/Html/Escaping/Content.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { expect } from 'chai'
import * as Up from '../../../Main'
import { cast } from '../../Helpers'


describe('Within a text node, all instances of < and &', () => {
Expand Down Expand Up @@ -293,7 +292,7 @@ describe("Within an audio convention's fallback link content, all instances of <


context('Within a table of contents entry, all instances of < and & are escaped:', () => {
const NOT_USED = cast<string>(null)
const NOT_USED: string = null!

specify('In the table of contents itself', () => {
const heading =
Expand Down
3 changes: 1 addition & 2 deletions src/Test/Html/IdWordDelimiting.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { expect } from 'chai'
import * as Up from '../../Main'
import { cast } from '../Helpers'


const NOT_USED = cast<string>(null)
const NOT_USED: string = null!

context('Words within HTML IDs are delimited by hyphens.', () => {
context('This applies to terms appearing in IDs:', () => {
Expand Down
3 changes: 1 addition & 2 deletions src/Test/Html/Links/NestedLink.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { expect } from 'chai'
import * as Up from '../../../Main'
import { cast } from '../../Helpers'


const NOT_USED = cast<string>(null)
const NOT_USED: string = null!

context('Inside a link', () => {
specify("a footnote does not produce another <a> element. The footnote's <sup> directly contains the footnote's reference number", () => {
Expand Down
3 changes: 1 addition & 2 deletions src/Test/Html/Settings/Changes.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { expect } from 'chai'
import * as Up from '../../../Main'
import { cast } from '../../Helpers'


function itCanBeProvidedMultipleWaysWithTheSameResult(
Expand Down Expand Up @@ -138,7 +137,7 @@ describe('The "footnote" term', () => {


describe('The "sectionReferencedByTableOfContents" setting', () => {
const NOT_USED = cast<string>(null)
const NOT_USED: string = null!

const heading = new Up.Heading([], { level: 1, titleMarkup: NOT_USED })

Expand Down
3 changes: 1 addition & 2 deletions src/Test/Html/Settings/IdPrefix.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { expect } from 'chai'
import * as Up from '../../../Main'
import { cast } from '../../Helpers'


describe("A footnote reference's ID (as well as the ID of the footnote it points to)", () => {
Expand Down Expand Up @@ -352,7 +351,7 @@ describe('The IDs and names of elements rendered for revealable blocks', () => {
})


const NOT_USED = cast<string>(null)
const NOT_USED: string = null!

describe('The ID of an element referenced by the table of contents', () => {
it("is prefixed with the default ID prefix 'up' if one wasn't provided", () => {
Expand Down
3 changes: 1 addition & 2 deletions src/Test/Html/Settings/SectionReferencedByTableOfContents.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { expect } from 'chai'
import * as Up from '../../../Main'
import { cast } from '../../Helpers'


describe('The ID of an element referenced by the table of contents', () => {
Expand All @@ -11,7 +10,7 @@ describe('The ID of an element referenced by the table of contents', () => {
}
})

const NOT_USED = cast<string>(null)
const NOT_USED: string = null!

const heading =
new Up.Heading([new Up.Text('I enjoy apples')], {
Expand Down
3 changes: 1 addition & 2 deletions src/Test/Html/SingleNode.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { expect } from 'chai'
import * as Up from '../../Main'
import { cast } from '../Helpers'


const NOT_USED = cast<string>(null)
const NOT_USED: string = null!

describe('An empty document', () => {
it('does not produce any HTML on its own', () => {
Expand Down
3 changes: 1 addition & 2 deletions src/Test/Html/SourceMap.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { expect } from 'chai'
import * as Up from '../../Main'
import { cast } from '../Helpers'


context('When an outline syntax node has a source line number, its outermost element is given an "data-up-source-line" attribute whose value is the line number. This is true for:', () => {
Expand Down Expand Up @@ -239,7 +238,7 @@ context('When an outline syntax node has a source line number, its outermost ele
+ '</blockquote>')
})

const NOT_USED = cast<string>(null)
const NOT_USED: string = null!

specify('Level 1 headings', () => {
const document = new Up.Document([
Expand Down
3 changes: 1 addition & 2 deletions src/Test/Html/TableOfContents.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { expect } from 'chai'
import * as Up from '../../Main'
import { cast } from '../Helpers'


const NOT_USED = cast<string>(null)
const NOT_USED: string = null!

specify('When a document has no table of contents entries, the table of contents renders a blank string', () => {
const document =
Expand Down
4 changes: 2 additions & 2 deletions src/Test/Parsing/Image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ describe("An image convention's URL", () => {
})


describe('An image description (enclosed in square brackets)', () => {
describe('An image description enclosed in square brackets', () => {
it('can contain matching square brackets', () => {
expect(Up.parse('[image: haunted [house]](http://example.com/?state=NE)')).to.deep.equal(
new Up.Document([
Expand All @@ -207,7 +207,7 @@ describe('An image description (enclosed in square brackets)', () => {
})


describe('An image description (enclosed by parentheses)', () => {
describe('An image description enclosed in parentheses', () => {
it('can contain matching parentheses', () => {
expect(Up.parse('(image: ghosts eating (luggage))[http://example.com/?state=NE]')).to.deep.equal(
new Up.Document([
Expand Down
7 changes: 1 addition & 6 deletions src/Test/Parsing/NumberedList/Order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,8 @@ context('When the starting ordinal is negative', () => {


function expectListOrderToBe(order: Up.NumberedList.Order, numberedListMarkup: string): void {
expect(listOrder(numberedListMarkup)).to.equal(order)
}


function listOrder(numberedListMarkup: string): Up.NumberedList.Order {
const list =
Up.parse(numberedListMarkup).children[0] as Up.NumberedList

return list.order()
expect(list.order()).to.equal(order)
}
7 changes: 4 additions & 3 deletions src/Test/Parsing/Settings/ChangesToKeywords.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { expect } from 'chai'
import { distinct } from '../../../Implementation/CollectionHelpers'
import * as Up from '../../../Main'
import { cast } from '../../Helpers'
import { settingsFor } from './Helpers'


Expand Down Expand Up @@ -217,8 +216,10 @@ function itCanBeProvidedMultipleWaysWithTheSameResult(
}


const NULL_KEYWORD = cast<string>(null)
const UNDEFINED_KEYWORD = cast<string>(undefined)
// The API doesn't officially accept `null` or `undefined` keywords, but we'll
// nonetheless ensure they politely ignored.
const NULL_KEYWORD: string = null!
const UNDEFINED_KEYWORD: string = undefined!

describe('The "audio" keyword', () => {
itCanBeProvidedMultipleWaysWithTheSameResult({
Expand Down

0 comments on commit 8313014

Please sign in to comment.