Skip to content

Commit

Permalink
Export Formatter and HtmlFormatter (#807)
Browse files Browse the repository at this point in the history
  • Loading branch information
martijnversluis authored Jan 9, 2023
1 parent cf6683e commit 0175d05
Show file tree
Hide file tree
Showing 2 changed files with 138 additions and 40 deletions.
82 changes: 42 additions & 40 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,86 +1,88 @@
import ChordLyricsPair from './chord_sheet/chord_lyrics_pair';
import ChordProFormatter from './formatter/chord_pro_formatter';
import ChordProParser from './parser/chord_pro_parser';
import ChordSheetParser from './parser/chord_sheet_parser';
import ChordSheetSerializer from './chord_sheet_serializer';
import ChordsOverWordsParser from './parser/chords_over_words_parser';
import UltimateGuitarParser from './parser/ultimate_guitar_parser';
import TextFormatter from './formatter/text_formatter';
import HtmlTableFormatter from './formatter/html_table_formatter';
import Comment from './chord_sheet/comment';
import Composite from './chord_sheet/chord_pro/composite';
import HtmlDivFormatter from './formatter/html_div_formatter';
import ChordProFormatter from './formatter/chord_pro_formatter';
import ChordLyricsPair from './chord_sheet/chord_lyrics_pair';
import HtmlTableFormatter from './formatter/html_table_formatter';
import Line from './chord_sheet/line';
import Song from './chord_sheet/song';
import Tag from './chord_sheet/tag';
import Comment from './chord_sheet/comment';
import Literal from './chord_sheet/chord_pro/literal';
import Metadata from './chord_sheet/metadata';
import Paragraph from './chord_sheet/paragraph';
import Song from './chord_sheet/song';
import Tag from './chord_sheet/tag';
import Ternary from './chord_sheet/chord_pro/ternary';
import Composite from './chord_sheet/chord_pro/composite';
import Literal from './chord_sheet/chord_pro/literal';
import ChordSheetSerializer from './chord_sheet_serializer';
import TextFormatter from './formatter/text_formatter';
import UltimateGuitarParser from './parser/ultimate_guitar_parser';

import {
CHORUS,
INDETERMINATE,
VERSE,
NONE,
TAB,
VERSE,
} from './constants';

export { default as Chord, parseChord } from './chord';
export { default as ChordLyricsPair } from './chord_sheet/chord_lyrics_pair';
export { default as ChordProFormatter } from './formatter/chord_pro_formatter';
export { default as ChordProParser } from './parser/chord_pro_parser';
export { default as ChordSheetParser } from './parser/chord_sheet_parser';
export { default as ChordSheetSerializer } from './chord_sheet_serializer';
export { default as ChordsOverWordsParser } from './parser/chords_over_words_parser';
export { default as UltimateGuitarParser } from './parser/ultimate_guitar_parser';
export { default as TextFormatter } from './formatter/text_formatter';
export { default as HtmlTableFormatter } from './formatter/html_table_formatter';
export { default as Comment } from './chord_sheet/comment';
export { default as Composite } from './chord_sheet/chord_pro/composite';
export { default as Formatter } from './formatter/formatter';
export { default as HtmlFormatter } from './formatter/html_formatter';
export { default as HtmlDivFormatter } from './formatter/html_div_formatter';
export { default as ChordProFormatter } from './formatter/chord_pro_formatter';
export { default as ChordLyricsPair } from './chord_sheet/chord_lyrics_pair';
export { default as HtmlTableFormatter } from './formatter/html_table_formatter';
export { default as Key } from './key';
export { default as Line } from './chord_sheet/line';
export { default as Song } from './chord_sheet/song';
export { default as Tag } from './chord_sheet/tag';
export { default as Comment } from './chord_sheet/comment';
export { default as Literal } from './chord_sheet/chord_pro/literal';
export { default as Metadata } from './chord_sheet/metadata';
export { default as Paragraph } from './chord_sheet/paragraph';
export { default as Song } from './chord_sheet/song';
export { default as Tag } from './chord_sheet/tag';
export { default as Ternary } from './chord_sheet/chord_pro/ternary';
export { default as Composite } from './chord_sheet/chord_pro/composite';
export { default as Literal } from './chord_sheet/chord_pro/literal';
export { default as ChordSheetSerializer } from './chord_sheet_serializer';
export { default as Chord, parseChord } from './chord';
export { default as Key } from './key';
export { default as TextFormatter } from './formatter/text_formatter';
export { default as UltimateGuitarParser } from './parser/ultimate_guitar_parser';

export {
CHORUS,
INDETERMINATE,
VERSE,
NONE,
TAB,
SYMBOL,
NUMERIC,
SYMBOL,
TAB,
VERSE,
} from './constants';

export default {
ChordLyricsPair,
ChordProFormatter,
ChordProParser,
ChordSheetParser,
ChordSheetSerializer,
ChordsOverWordsParser,
UltimateGuitarParser,
TextFormatter,
HtmlTableFormatter,
Comment,
Composite,
HtmlDivFormatter,
ChordProFormatter,
ChordLyricsPair,
HtmlTableFormatter,
Line,
Song,
Tag,
Comment,
Literal,
Metadata,
Paragraph,
Song,
Tag,
Ternary,
Composite,
Literal,
ChordSheetSerializer,
TextFormatter,
UltimateGuitarParser,
CHORUS,
INDETERMINATE,
NONE,
TAB,
VERSE,
NONE,
};
96 changes: 96 additions & 0 deletions test/exports.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
import ChordSheetJS, {
Chord,
ChordLyricsPair,
ChordProFormatter,
ChordProParser,
ChordSheetParser,
ChordSheetSerializer,
ChordsOverWordsParser,
Comment,
Composite,
Formatter,
HtmlFormatter,
HtmlDivFormatter,
HtmlTableFormatter,
Key,
Line,
Literal,
Metadata,
Paragraph,
Song,
Tag,
Ternary,
TextFormatter,
UltimateGuitarParser,
CHORUS,
INDETERMINATE,
NONE,
NUMERIC,
SYMBOL,
TAB,
VERSE,
parseChord,
} from '../src';

describe('exports', () => {
it('supplies all required constants as named exports', () => {
expect(Chord).toBeDefined();
expect(ChordLyricsPair).toBeDefined();
expect(ChordProFormatter).toBeDefined();
expect(ChordProParser).toBeDefined();
expect(ChordSheetParser).toBeDefined();
expect(ChordSheetSerializer).toBeDefined();
expect(ChordsOverWordsParser).toBeDefined();
expect(Comment).toBeDefined();
expect(Composite).toBeDefined();
expect(Formatter).toBeDefined();
expect(HtmlFormatter).toBeDefined();
expect(HtmlDivFormatter).toBeDefined();
expect(HtmlTableFormatter).toBeDefined();
expect(Key).toBeDefined();
expect(Line).toBeDefined();
expect(Literal).toBeDefined();
expect(Metadata).toBeDefined();
expect(Paragraph).toBeDefined();
expect(Song).toBeDefined();
expect(Tag).toBeDefined();
expect(Ternary).toBeDefined();
expect(TextFormatter).toBeDefined();
expect(UltimateGuitarParser).toBeDefined();
expect(CHORUS).toBeDefined();
expect(INDETERMINATE).toBeDefined();
expect(NONE).toBeDefined();
expect(NUMERIC).toBeDefined();
expect(SYMBOL).toBeDefined();
expect(TAB).toBeDefined();
expect(VERSE).toBeDefined();
expect(parseChord).toBeDefined();
});

it('supplies all constants as properties of the default export', () => {
expect(ChordSheetJS.ChordProParser).toBeDefined();
expect(ChordSheetJS.ChordSheetParser).toBeDefined();
expect(ChordSheetJS.ChordsOverWordsParser).toBeDefined();
expect(ChordSheetJS.UltimateGuitarParser).toBeDefined();
expect(ChordSheetJS.TextFormatter).toBeDefined();
expect(ChordSheetJS.HtmlTableFormatter).toBeDefined();
expect(ChordSheetJS.HtmlDivFormatter).toBeDefined();
expect(ChordSheetJS.ChordProFormatter).toBeDefined();
expect(ChordSheetJS.ChordLyricsPair).toBeDefined();
expect(ChordSheetJS.Line).toBeDefined();
expect(ChordSheetJS.Song).toBeDefined();
expect(ChordSheetJS.Tag).toBeDefined();
expect(ChordSheetJS.Comment).toBeDefined();
expect(ChordSheetJS.Metadata).toBeDefined();
expect(ChordSheetJS.Paragraph).toBeDefined();
expect(ChordSheetJS.Ternary).toBeDefined();
expect(ChordSheetJS.Composite).toBeDefined();
expect(ChordSheetJS.Literal).toBeDefined();
expect(ChordSheetJS.ChordSheetSerializer).toBeDefined();
expect(ChordSheetJS.CHORUS).toBeDefined();
expect(ChordSheetJS.INDETERMINATE).toBeDefined();
expect(ChordSheetJS.NONE).toBeDefined();
expect(ChordSheetJS.TAB).toBeDefined();
expect(ChordSheetJS.VERSE).toBeDefined();
});
});

0 comments on commit 0175d05

Please sign in to comment.