From 62a01dfd3b14f34151e86cac7f31509fd712c899 Mon Sep 17 00:00:00 2001 From: FiniteLooper Date: Sun, 3 Sep 2023 16:52:22 -0400 Subject: [PATCH] max line length update for test files --- .editorconfig | 3 + src/app/app.component.spec.ts | 11 +- src/app/convert/convert.component.spec.ts | 112 ++++-------------- .../download-display.component.spec.ts | 6 +- src/app/convert/errors/errors.service.spec.ts | 8 +- .../inputs/input-type-chordpro.spec.ts | 32 +---- .../convert/inputs/input-type-json.spec.ts | 19 +-- .../inputs/input-type-openlyrics.spec.ts | 60 +++------- .../inputs/input-type-plain-text.spec.ts | 45 ++----- .../inputs/input-type-propresenter4.spec.ts | 27 ++--- .../inputs/input-type-propresenter5.spec.ts | 35 ++---- .../inputs/input-type-propresenter6.spec.ts | 25 +--- .../convert/inputs/input-type-songpro.spec.ts | 24 ++-- .../inputs/input-type-songshowplus7.spec.ts | 74 +++--------- .../convert/outputs/output-type-json.spec.ts | 6 +- .../outputs/output-type-openlyrics.spec.ts | 40 ++----- .../outputs/output-type-plain-text.spec.ts | 4 +- .../outputs/output-type-propresenter5.spec.ts | 30 ++--- .../outputs/output-type-propresenter6.spec.ts | 30 ++--- src/app/convert/parser/parser.service.spec.ts | 10 +- src/app/convert/shared/utils.spec.ts | 13 +- .../drag-and-drop-files.directive.spec.ts | 10 +- 22 files changed, 154 insertions(+), 470 deletions(-) diff --git a/.editorconfig b/.editorconfig index 8cacb9c..3a4e563 100644 --- a/.editorconfig +++ b/.editorconfig @@ -12,6 +12,9 @@ max_line_length = 100 [*.ts] quote_type = single +[*.spec.ts] +max_line_length = 150 + [*.md] max_line_length = off trim_trailing_whitespace = false diff --git a/src/app/app.component.spec.ts b/src/app/app.component.spec.ts index de57ea1..ea0e808 100644 --- a/src/app/app.component.spec.ts +++ b/src/app/app.component.spec.ts @@ -17,14 +17,7 @@ describe('AppComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ imports: [RouterTestingModule], - declarations: [ - AppComponent, - HelpComponent, - AboutComponent, - ConvertComponent, - DonateButtonComponent, - DragAndDropFilesDirective, - ], + declarations: [AppComponent, HelpComponent, AboutComponent, ConvertComponent, DonateButtonComponent, DragAndDropFilesDirective], }); fixture = TestBed.createComponent(AppComponent); @@ -38,6 +31,6 @@ describe('AppComponent', () => { it('should set a random background image on the element', () => { fixture.detectChanges(); - expect(injectedDocument.body.getAttribute('style')).toMatch(/background-image: url\("\/assets\/bg\d+.jpg"\);/) + expect(injectedDocument.body.getAttribute('style')).toMatch(/background-image: url\("\/assets\/bg\d+.jpg"\);/); }); }); diff --git a/src/app/convert/convert.component.spec.ts b/src/app/convert/convert.component.spec.ts index 6c1ad81..0dc1354 100644 --- a/src/app/convert/convert.component.spec.ts +++ b/src/app/convert/convert.component.spec.ts @@ -39,13 +39,7 @@ describe('ConvertComponent', () => { function configureTestBed(providers: Array) { TestBed.configureTestingModule({ - declarations: [ - ConvertComponent, - DonateButtonComponent, - DragAndDropFilesDirective, - SlideDisplayComponent, - DownloadDisplayComponent, - ], + declarations: [ConvertComponent, DonateButtonComponent, DragAndDropFilesDirective, SlideDisplayComponent, DownloadDisplayComponent], providers, }); parserSvc = TestBed.inject(ParserService); @@ -71,11 +65,7 @@ describe('ConvertComponent', () => { new MockConverter('No File Ext'), ]; - mockParserService.inputConverters = [ - new MockConverter('FooIn', 'foo'), - new MockConverter('BarIn', 'bar'), - new MockConverter('BazIn', 'baz'), - ]; + mockParserService.inputConverters = [new MockConverter('FooIn', 'foo'), new MockConverter('BarIn', 'bar'), new MockConverter('BazIn', 'baz')]; configureTestBed([{ provide: ParserService, useValue: mockParserService }, ErrorsService]); }); @@ -109,10 +99,7 @@ describe('ConvertComponent', () => { it('should change the conversion type when switchConversionType() is called', () => { fixture.detectChanges(); - component.onSwitchConversionType( - mockParserService.outputConverters[3]!, - new Event('click') - ); + component.onSwitchConversionType(mockParserService.outputConverters[3]!, new Event('click')); fixture.detectChanges(); expect(component.selectedOutputType.name).toEqual('No File Ext'); }); @@ -120,9 +107,7 @@ describe('ConvertComponent', () => { it('should change the conversion type when a link in the menu is clicked', () => { fixture.detectChanges(); - fixture.debugElement - .query(By.css('#test-convert-types-nav a:nth-of-type(2)')) - .triggerEventHandler('click', new Event('click')); + fixture.debugElement.query(By.css('#test-convert-types-nav a:nth-of-type(2)')).triggerEventHandler('click', new Event('click')); fixture.detectChanges(); expect(component.selectedOutputType.name).toEqual('BarOut'); @@ -131,9 +116,7 @@ describe('ConvertComponent', () => { it('should save the conversion type preference when a link in the menu is clicked', () => { fixture.detectChanges(); - fixture.debugElement - .query(By.css('#test-convert-types-nav a:nth-of-type(2)')) - .triggerEventHandler('click', new Event('click')); + fixture.debugElement.query(By.css('#test-convert-types-nav a:nth-of-type(2)')).triggerEventHandler('click', new Event('click')); fixture.detectChanges(); expect(localStorage.getItem(prefKey)).toEqual('BarOut'); @@ -144,12 +127,9 @@ describe('ConvertComponent', () => { it('should list out all available input type names for accepted file formats', () => { fixture.detectChanges(); - expect( - ( - fixture.debugElement.query(By.css('#test-accepted-input-formats')) - .nativeElement as HTMLElement - ).textContent - ).toContain('FooIn, BarIn, or BazIn'); + expect((fixture.debugElement.query(By.css('#test-accepted-input-formats')).nativeElement as HTMLElement).textContent).toContain( + 'FooIn, BarIn, or BazIn' + ); }); }); }); @@ -185,9 +165,7 @@ describe('ConvertComponent', () => { parserSvc.parsedFilesChanged$.subscribe(() => { fixture.detectChanges(); - expect(component.displayInitialUi) - .withContext('The displayInitialUi property') - .toBeFalse(); + expect(component.displayInitialUi).withContext('The displayInitialUi property').toBeFalse(); expect(fixture.debugElement.query(By.css('#begin-area'))) .withContext('#begin-area Element') .toBeNull(); @@ -197,18 +175,10 @@ describe('ConvertComponent', () => { expect(fixture.debugElement.query(By.css('#display-area'))) .withContext('#display-area Element') .not.toBeNull(); - expect( - fixture.debugElement - .query(By.css('#display-area')) - .query(By.directive(SlideDisplayComponent)) - ) + expect(fixture.debugElement.query(By.css('#display-area')).query(By.directive(SlideDisplayComponent))) .withContext('The SlideDisplayComponent inside of the #display-area Element') .not.toBeNull(); - expect( - fixture.debugElement - .query(By.css('#display-area')) - .query(By.directive(DownloadDisplayComponent)) - ) + expect(fixture.debugElement.query(By.css('#display-area')).query(By.directive(DownloadDisplayComponent))) .withContext('The DownloadDisplayComponent inside of the #display-area Element') .toBeNull(); @@ -229,9 +199,7 @@ describe('ConvertComponent', () => { parserSvc.parsedFilesChanged$.subscribe(() => { fixture.detectChanges(); - expect(component.displayInitialUi) - .withContext('The displayInitialUi property') - .toBeFalse(); + expect(component.displayInitialUi).withContext('The displayInitialUi property').toBeFalse(); expect(fixture.debugElement.query(By.css('#begin-area'))) .withContext('#begin-area Element') .toBeNull(); @@ -241,18 +209,10 @@ describe('ConvertComponent', () => { expect(fixture.debugElement.query(By.css('#display-area'))) .withContext('#display-area Element') .not.toBeNull(); - expect( - fixture.debugElement - .query(By.css('#display-area')) - .query(By.directive(SlideDisplayComponent)) - ) + expect(fixture.debugElement.query(By.css('#display-area')).query(By.directive(SlideDisplayComponent))) .withContext('The SlideDisplayComponent inside of the #display-area Element') .toBeNull(); - expect( - fixture.debugElement - .query(By.css('#display-area')) - .query(By.directive(DownloadDisplayComponent)) - ) + expect(fixture.debugElement.query(By.css('#display-area')).query(By.directive(DownloadDisplayComponent))) .withContext('The DownloadDisplayComponent inside of the #display-area Element') .not.toBeNull(); @@ -351,39 +311,30 @@ describe('ConvertComponent', () => { it('should trigger a click event on the file chooser when the "select some files" link is clicked', () => { fixture.detectChanges(); - const inputEl = fixture.debugElement.query(By.css('input[type="file"]')) - .nativeElement as HTMLInputElement; + const inputEl = fixture.debugElement.query(By.css('input[type="file"]')).nativeElement as HTMLInputElement; spyOn(inputEl, 'click').and.callFake(() => {}); - const selectFilesLinkEl = fixture.debugElement.query(By.css('#begin-area a')) - .nativeElement as HTMLAnchorElement; + const selectFilesLinkEl = fixture.debugElement.query(By.css('#begin-area a')).nativeElement as HTMLAnchorElement; const clickEvent = new Event('click'); selectFilesLinkEl.dispatchEvent(clickEvent); fixture.detectChanges(); - expect(inputEl.click) - .withContext('The "select some files" link that triggers the file input') - .toHaveBeenCalledTimes(1); + expect(inputEl.click).withContext('The "select some files" link that triggers the file input').toHaveBeenCalledTimes(1); }); it('should trigger a click event on the file chooser when the "select some more files" link is clicked', () => { component.displayInitialUi = false; fixture.detectChanges(); - const inputEl = fixture.debugElement.query(By.css('input[type="file"]')) - .nativeElement as HTMLInputElement; + const inputEl = fixture.debugElement.query(By.css('input[type="file"]')).nativeElement as HTMLInputElement; spyOn(inputEl, 'click').and.callFake(() => {}); - const selectFilesLinkEl = fixture.debugElement.query( - By.css('#test-drop-instructions-more a') - ).nativeElement as HTMLAnchorElement; + const selectFilesLinkEl = fixture.debugElement.query(By.css('#test-drop-instructions-more a')).nativeElement as HTMLAnchorElement; const clickEvent = new Event('click'); selectFilesLinkEl.dispatchEvent(clickEvent); fixture.detectChanges(); - expect(inputEl.click) - .withContext('The "select some more files" link that triggers the file input') - .toHaveBeenCalledTimes(1); + expect(inputEl.click).withContext('The "select some more files" link that triggers the file input').toHaveBeenCalledTimes(1); }); }); @@ -429,8 +380,7 @@ describe('ConvertComponent', () => { }, { title: 'Bridge', - lyrics: - 'So remember you people\r\nRemember your children\r\nRemember your promise\r\nOh God', + lyrics: 'So remember you people\r\nRemember your children\r\nRemember your promise\r\nOh God', }, ], }, @@ -591,9 +541,7 @@ describe('ConvertComponent', () => { }, ]); - const expectedErr = new LyricConverterError( - 'This file is not formatted as a LyricConverter JSON file' - ); + const expectedErr = new LyricConverterError('This file is not formatted as a LyricConverter JSON file'); expect(errorsSvc.add).toHaveBeenCalledWith({ message: expectedErr.message, fileName: 'bad-file.json', @@ -702,22 +650,12 @@ describe('ConvertComponent', () => { expect(errorListEl.queryAll(By.css('ul li')).length) .withContext('The count of displayed error messages') .toEqual(2); - expect( - ( - errorListEl.query(By.css('ul li:nth-of-type(1)')).nativeElement as HTMLElement - ).innerText.trim() - ) + expect((errorListEl.query(By.css('ul li:nth-of-type(1)')).nativeElement as HTMLElement).innerText.trim()) .withContext('The 1st error message in the list') .toEqual('[[TEST:convert.component.spec.ts]] Just a message'); - expect( - ( - errorListEl.query(By.css('ul li:nth-of-type(2)')).nativeElement as HTMLElement - ).innerText.trim() - ) + expect((errorListEl.query(By.css('ul li:nth-of-type(2)')).nativeElement as HTMLElement).innerText.trim()) .withContext('The 2nd error message in the list') - .toEqual( - 'not-a-virus.exe - [[TEST:convert.component.spec.ts]] A message with a file name' - ); + .toEqual('not-a-virus.exe - [[TEST:convert.component.spec.ts]] A message with a file name'); }); }); }); diff --git a/src/app/convert/download-display/download-display.component.spec.ts b/src/app/convert/download-display/download-display.component.spec.ts index eab7c85..81458b2 100644 --- a/src/app/convert/download-display/download-display.component.spec.ts +++ b/src/app/convert/download-display/download-display.component.spec.ts @@ -57,12 +57,10 @@ describe('DownloadDisplayComponent', () => { expect(fixture.debugElement.queryAll(By.css('.btn')).length).toEqual(2); - const btn1 = fixture.debugElement.query(By.css('.btn:nth-of-type(1)')) - .nativeElement as HTMLButtonElement; + const btn1 = fixture.debugElement.query(By.css('.btn:nth-of-type(1)')).nativeElement as HTMLButtonElement; expect(btn1.textContent?.trim()).toEqual('Download as .zip'); - const btn2 = fixture.debugElement.query(By.css('.btn:nth-of-type(2)')) - .nativeElement as HTMLButtonElement; + const btn2 = fixture.debugElement.query(By.css('.btn:nth-of-type(2)')).nativeElement as HTMLButtonElement; expect(btn2.textContent?.trim()).toEqual('Download 2 individual files'); }); diff --git a/src/app/convert/errors/errors.service.spec.ts b/src/app/convert/errors/errors.service.spec.ts index 3dc29ce..2f7e718 100644 --- a/src/app/convert/errors/errors.service.spec.ts +++ b/src/app/convert/errors/errors.service.spec.ts @@ -26,9 +26,7 @@ describe('ErrorsService', () => { it('should emit the list of errors when an error with a message and a file name is added', (done: DoneFn) => { service.errorsChanged$.subscribe((list) => { - expect(list).toEqual([ - { message: '[[TEST:errors.service.spec.ts]] Test Message 2', fileName: 'example-file.exe' }, - ]); + expect(list).toEqual([{ message: '[[TEST:errors.service.spec.ts]] Test Message 2', fileName: 'example-file.exe' }]); done(); }); @@ -60,9 +58,7 @@ describe('ErrorsService', () => { }); it('should emit the list of errors and use the custom error message instead of the default message when a custom error object is attached', (done: DoneFn) => { - const customErrorObj = new LyricConverterError( - '[[TEST:errors.service.spec.ts]] Test Message 4' - ); + const customErrorObj = new LyricConverterError('[[TEST:errors.service.spec.ts]] Test Message 4'); service.errorsChanged$.subscribe((list) => { expect(list).toEqual([ diff --git a/src/app/convert/inputs/input-type-chordpro.spec.ts b/src/app/convert/inputs/input-type-chordpro.spec.ts index 7dd1e51..853a144 100644 --- a/src/app/convert/inputs/input-type-chordpro.spec.ts +++ b/src/app/convert/inputs/input-type-chordpro.spec.ts @@ -69,21 +69,10 @@ describe('InputTypeChordPro', () => { fileName: testFile.name, title: 'This is a title', info: [ - { - name: 'artist', - value: 'Hymn', - }, - { - name: 'key', - value: 'E', - }, - ], - slides: [ - { - title: 'Verse 1', - lyrics: `I know a place\nA wonderful place`, - }, + { name: 'artist', value: 'Hymn' }, + { name: 'key', value: 'E' }, ], + slides: [{ title: 'Verse 1', lyrics: `I know a place\nA wonderful place` }], }); }); @@ -271,18 +260,9 @@ describe('InputTypeChordPro', () => { fileName: testFile.name, title: 'Our Father', info: [ - { - name: 'artist', - value: 'Bethel Music', - }, - { - name: 'key', - value: 'G', - }, - { - name: 'comment', - value: 'Words and Music by Marcus Meier', - }, + { name: 'artist', value: 'Bethel Music' }, + { name: 'key', value: 'G' }, + { name: 'comment', value: 'Words and Music by Marcus Meier' }, ], slides: [ { diff --git a/src/app/convert/inputs/input-type-json.spec.ts b/src/app/convert/inputs/input-type-json.spec.ts index dda2b4c..3c67a70 100644 --- a/src/app/convert/inputs/input-type-json.spec.ts +++ b/src/app/convert/inputs/input-type-json.spec.ts @@ -55,23 +55,16 @@ describe('InputTypeJSON', () => { ext: 'json', type: 'text/json', dataAsBuffer: new ArrayBuffer(0), //not needed for this file type - dataAsString: '{"title":"Great is your faithfulness O God","info":[{"name":"Order","value":"1C2CBC"}],"slides":[{"title":"Chorus","lyrics":"Your grace is enough\\r\\nYour grace is enough\\r\\nYour grace is enough for me"},{"title":"Verse 1","lyrics":"Great is your faithfulness O God\\r\\nYou wrestle with the sinners heart\\r\\nYou lead us by still waters and to mercy\\r\\nAnd nothing can keep us apart"}]}', + dataAsString: + '{"title":"Great is your faithfulness O God","info":[{"name":"Order","value":"1C2CBC"}],"slides":[{"title":"Chorus","lyrics":"Your grace is enough\\r\\nYour grace is enough\\r\\nYour grace is enough for me"},{"title":"Verse 1","lyrics":"Great is your faithfulness O God\\r\\nYou wrestle with the sinners heart\\r\\nYou lead us by still waters and to mercy\\r\\nAnd nothing can keep us apart"}]}', }; expect(inputConverter.extractSongData(testFile)).toEqual({ fileName: testFile.name, title: 'Great is your faithfulness O God', - info: [ - { - name: 'Order', - value: '1C2CBC', - }, - ], + info: [{ name: 'Order', value: '1C2CBC' }], slides: [ - { - title: 'Chorus', - lyrics: 'Your grace is enough\r\nYour grace is enough\r\nYour grace is enough for me', - }, + { title: 'Chorus', lyrics: 'Your grace is enough\r\nYour grace is enough\r\nYour grace is enough for me' }, { title: 'Verse 1', lyrics: @@ -90,9 +83,7 @@ describe('InputTypeJSON', () => { dataAsString: '{}', }; - const err = new LyricConverterError( - `This file is not formatted as a LyricConverter JSON file` - ); + const err = new LyricConverterError(`This file is not formatted as a LyricConverter JSON file`); expect(() => inputConverter.extractSongData(testFile)).toThrow(err); }); diff --git a/src/app/convert/inputs/input-type-openlyrics.spec.ts b/src/app/convert/inputs/input-type-openlyrics.spec.ts index 8226e1b..2fcf604 100644 --- a/src/app/convert/inputs/input-type-openlyrics.spec.ts +++ b/src/app/convert/inputs/input-type-openlyrics.spec.ts @@ -14,10 +14,7 @@ describe('InputTypeOpenLyrics', () => { describe('doesInputFileMatchThisType()', () => { it('should properly ACCEPT a OpenLyrics XML file when tested', async () => { - const testFile = await TestUtils.loadTestFileAsRawDataFile( - 'OpenLyrics/examples', - 'simple.xml' - ); + const testFile = await TestUtils.loadTestFileAsRawDataFile('OpenLyrics/examples', 'simple.xml'); expect(inputConverter.doesInputFileMatchThisType(testFile)).toBeTrue(); }); @@ -44,10 +41,7 @@ describe('InputTypeOpenLyrics', () => { describe('extractSongData()', () => { it('should return a song for a simple OpenLyrics file', async () => { - const testFile = await TestUtils.loadTestFileAsRawDataFile( - 'OpenLyrics/examples', - 'simple.xml' - ); + const testFile = await TestUtils.loadTestFileAsRawDataFile('OpenLyrics/examples', 'simple.xml'); expect(inputConverter.extractSongData(testFile)).toEqual({ fileName: testFile.name, @@ -63,10 +57,7 @@ describe('InputTypeOpenLyrics', () => { }); it('should return a song for a complex OpenLyrics file', async () => { - const testFile = await TestUtils.loadTestFileAsRawDataFile( - 'OpenLyrics/examples', - 'complex.xml' - ); + const testFile = await TestUtils.loadTestFileAsRawDataFile('OpenLyrics/examples', 'complex.xml'); expect(inputConverter.extractSongData(testFile)).toEqual({ fileName: testFile.name, @@ -84,8 +75,7 @@ describe('InputTypeOpenLyrics', () => { { name: 'verseOrder', value: 'v1 v2 v3 c v4 c1 c2 b b1 b2' }, { name: 'Authors', - value: - 'John Newton | Chris Rice (words) | Richard Wagner (music) | František Foo (translation)', + value: 'John Newton | Chris Rice (words) | Richard Wagner (music) | František Foo (translation)', }, { name: 'Comment', @@ -136,10 +126,7 @@ describe('InputTypeOpenLyrics', () => { }); it('should use the filename for the title if there is no title', async () => { - const testFile = await TestUtils.loadTestFileAsRawDataFile( - 'OpenLyrics/examples', - 'simple.xml' - ); + const testFile = await TestUtils.loadTestFileAsRawDataFile('OpenLyrics/examples', 'simple.xml'); //remove the titles so the parser can't find one testFile.dataAsString = testFile.dataAsString.replace(/[\W\w]+?<\/titles>/, ''); @@ -148,10 +135,7 @@ describe('InputTypeOpenLyrics', () => { }); it('should ignore/exclude comments from the song lyrics', async () => { - const testFile = await TestUtils.loadTestFileAsRawDataFile( - 'OpenLyrics/examples', - 'simple.xml' - ); + const testFile = await TestUtils.loadTestFileAsRawDataFile('OpenLyrics/examples', 'simple.xml'); testFile.dataAsString = testFile.dataAsString.replace( 'how sweet the sound', @@ -172,10 +156,7 @@ describe('InputTypeOpenLyrics', () => { }); it('should return a song for a OpenLyrics example file 1', async () => { - const testFile = await TestUtils.loadTestFileAsRawDataFile( - 'OpenLyrics/songs', - 'Amazing Grace.xml' - ); + const testFile = await TestUtils.loadTestFileAsRawDataFile('OpenLyrics/songs', 'Amazing Grace.xml'); expect(inputConverter.extractSongData(testFile)).toEqual({ fileName: testFile.name, @@ -189,8 +170,7 @@ describe('InputTypeOpenLyrics', () => { slides: [ { title: 'v1', - lyrics: - "Amazing grace how sweet the sound that saved a wretch like me;\nI once was lost but now I'm found, was blind but now I see.", + lyrics: "Amazing grace how sweet the sound that saved a wretch like me;\nI once was lost but now I'm found, was blind but now I see.", }, { title: 'v2', @@ -212,10 +192,7 @@ describe('InputTypeOpenLyrics', () => { }); it('should return a song for a OpenLyrics example file 2', async () => { - const testFile = await TestUtils.loadTestFileAsRawDataFile( - 'OpenLyrics/songs', - 'It Is Well With My Soul.xml' - ); + const testFile = await TestUtils.loadTestFileAsRawDataFile('OpenLyrics/songs', 'It Is Well With My Soul.xml'); expect(inputConverter.extractSongData(testFile)).toEqual({ fileName: testFile.name, @@ -235,8 +212,7 @@ describe('InputTypeOpenLyrics', () => { }, { title: 'c', - lyrics: - 'It is well, (it is well,)\nWith my soul, (with my soul,)\nIt is well, it is well with my soul.', + lyrics: 'It is well, (it is well,)\nWith my soul, (with my soul,)\nIt is well, it is well with my soul.', }, { title: 'v2', @@ -259,10 +235,7 @@ describe('InputTypeOpenLyrics', () => { it('should return a song for a OpenLyrics example file 3 - a single songbook and multiple comments', async () => { // const testFile: IRawDataFile = structuredClone(mockOpenLyrics.mockOpenLyricsSongFile3); - const testFile = await TestUtils.loadTestFileAsRawDataFile( - 'OpenLyrics/examples', - 'multiple-comments.xml' - ); + const testFile = await TestUtils.loadTestFileAsRawDataFile('OpenLyrics/examples', 'multiple-comments.xml'); expect(inputConverter.extractSongData(testFile)).toEqual({ fileName: testFile.name, @@ -277,10 +250,7 @@ describe('InputTypeOpenLyrics', () => { }); it('should return a song for a OpenLyrics example file with Hebrew lyrics and transliterated lyrics', async () => { - const testFile = await TestUtils.loadTestFileAsRawDataFile( - 'OpenLyrics/songs', - 'Hava Nagila.xml' - ); + const testFile = await TestUtils.loadTestFileAsRawDataFile('OpenLyrics/songs', 'Hava Nagila.xml'); expect(inputConverter.extractSongData(testFile)).toEqual({ fileName: testFile.name, @@ -321,13 +291,11 @@ describe('InputTypeOpenLyrics', () => { }, { title: 'b (he - transliterated in en)', - lyrics: - "Uru, uru achim!\nUru achim b'lev sameach\n\nUru achim, uru achim!\nB'lev sameach", + lyrics: "Uru, uru achim!\nUru achim b'lev sameach\n\nUru achim, uru achim!\nB'lev sameach", }, { title: 'b (en)', - lyrics: - 'Awake, awake, brothers!\nAwake brothers with a happy heart\nAwake, brothers, awake, brothers!\nWith a happy heart', + lyrics: 'Awake, awake, brothers!\nAwake brothers with a happy heart\nAwake, brothers, awake, brothers!\nWith a happy heart', }, ], }); diff --git a/src/app/convert/inputs/input-type-plain-text.spec.ts b/src/app/convert/inputs/input-type-plain-text.spec.ts index 36b1830..b3145fd 100644 --- a/src/app/convert/inputs/input-type-plain-text.spec.ts +++ b/src/app/convert/inputs/input-type-plain-text.spec.ts @@ -53,24 +53,12 @@ describe('InputTypePlainText', () => { fileName: testFile.name, title: 'Your Grace is Enough', info: [ - { - name: 'CCLI Number', - value: '1234', - }, - { - name: 'artist', - value: 'Bethel Music', - }, - { - name: 'key', - value: 'G', - }, + { name: 'CCLI Number', value: '1234' }, + { name: 'artist', value: 'Bethel Music' }, + { name: 'key', value: 'G' }, ], slides: [ - { - title: 'Chorus', - lyrics: `Your grace is enough\nYour grace is enough\nYour grace is enough for me`, - }, + { title: 'Chorus', lyrics: `Your grace is enough\nYour grace is enough\nYour grace is enough for me` }, { title: 'Verse 1', lyrics: `Great is your faithfulness O God\nYou wrestle with the sinners heart\nYou lead us by still waters and to mercy\nAnd nothing can keep us apart`, @@ -90,32 +78,17 @@ describe('InputTypePlainText', () => { fileName: testFile.name, title: 'At the Cross', info: [ - { - name: 'artist', - value: 'Hymn', - }, - { - name: 'key', - value: 'E', - }, - { - name: 'comment', - value: 'Words and Music by Randy & Terry Butler', - }, - { - name: 'comment', - value: '(c)1993 Mercy Publishing', - }, + { name: 'artist', value: 'Hymn' }, + { name: 'key', value: 'E' }, + { name: 'comment', value: 'Words and Music by Randy & Terry Butler' }, + { name: 'comment', value: '(c)1993 Mercy Publishing' }, ], slides: [ { title: 'Verse', lyrics: `I know a place\nA wonderful place\nWhere accused and condemned\nFind mercy and grace\nWhere the wrongs we have done\nAnd the wrongs done to us\nWere nailed there with him\nThere on the cross`, }, - { - title: 'Chorus', - lyrics: `At the cross\nHe died for our sins\nAt the cross\nHe gave us life again`, - }, + { title: 'Chorus', lyrics: `At the cross\nHe died for our sins\nAt the cross\nHe gave us life again` }, ], }); }); diff --git a/src/app/convert/inputs/input-type-propresenter4.spec.ts b/src/app/convert/inputs/input-type-propresenter4.spec.ts index 6812271..3560373 100644 --- a/src/app/convert/inputs/input-type-propresenter4.spec.ts +++ b/src/app/convert/inputs/input-type-propresenter4.spec.ts @@ -47,20 +47,14 @@ describe('InputTypeProPresenter4', () => { describe('extractSongData()', () => { it('should get a TITLE from the file name when the file does not have a CCLISongTitle', async () => { - const testFile = await TestUtils.loadTestFileAsRawDataFile( - 'ProPresenter', - 'v4 - Be Near.pro4' - ); + const testFile = await TestUtils.loadTestFileAsRawDataFile('ProPresenter', 'v4 - Be Near.pro4'); testFile.dataAsString = testFile.dataAsString.replace('CCLISongTitle="Be Near" ', ''); expect(inputConverter.extractSongData(testFile).title).toEqual(testFile.name); }); it('should get a song from a ProPresenter 4 file1', async () => { - const testFile = await TestUtils.loadTestFileAsRawDataFile( - 'ProPresenter', - 'v4 - Be Near.pro4' - ); + const testFile = await TestUtils.loadTestFileAsRawDataFile('ProPresenter', 'v4 - Be Near.pro4'); expect(inputConverter.extractSongData(testFile)).toEqual({ fileName: testFile.name, @@ -79,23 +73,19 @@ describe('InputTypeProPresenter4', () => { }, { title: 'Verse 1', - lyrics: - "You are all big and small\nBeautiful\nAnd wonderful\nTo trust in grace through faith\nBut I'm asking to taste", + lyrics: "You are all big and small\nBeautiful\nAnd wonderful\nTo trust in grace through faith\nBut I'm asking to taste", }, { title: 'Verse 2', - lyrics: - 'For dark is light to You\nDepths are height to You\nFar is near\nBut Lord I need to hear from You', + lyrics: 'For dark is light to You\nDepths are height to You\nFar is near\nBut Lord I need to hear from You', }, { title: 'Verse 3', - lyrics: - 'Your fullness is mine\nRevelation divine\nBut oh to taste\nTo know much more than a page\nTo feel Your embrace', + lyrics: 'Your fullness is mine\nRevelation divine\nBut oh to taste\nTo know much more than a page\nTo feel Your embrace', }, { title: 'Verse 4', - lyrics: - 'For dark is light to You\nDepths are height to You\nFar is near\nBut Lord I need to hear from You', + lyrics: 'For dark is light to You\nDepths are height to You\nFar is near\nBut Lord I need to hear from You', }, { title: '', @@ -106,10 +96,7 @@ describe('InputTypeProPresenter4', () => { }); it('should get a song from a ProPresenter 4 file2', async () => { - const testFile = await TestUtils.loadTestFileAsRawDataFile( - 'ProPresenter', - 'v4 - Give Us Clean Hands.pro4' - ); + const testFile = await TestUtils.loadTestFileAsRawDataFile('ProPresenter', 'v4 - Give Us Clean Hands.pro4'); expect(inputConverter.extractSongData(testFile)).toEqual({ fileName: testFile.name, diff --git a/src/app/convert/inputs/input-type-propresenter5.spec.ts b/src/app/convert/inputs/input-type-propresenter5.spec.ts index c048cbb..69862ae 100644 --- a/src/app/convert/inputs/input-type-propresenter5.spec.ts +++ b/src/app/convert/inputs/input-type-propresenter5.spec.ts @@ -47,20 +47,14 @@ describe('InputTypeProPresenter5', () => { describe('extractSongData()', () => { it('should get a TITLE from the file name when the file does not have a CCLISongTitle', async () => { - const testFile = await TestUtils.loadTestFileAsRawDataFile( - 'ProPresenter', - 'v5 - Be Near.pro5' - ); + const testFile = await TestUtils.loadTestFileAsRawDataFile('ProPresenter', 'v5 - Be Near.pro5'); testFile.dataAsString = testFile.dataAsString.replace('CCLISongTitle="Be Near" ', ''); expect(inputConverter.extractSongData(testFile).title).toEqual(testFile.name); }); it('should get a song from a ProPresenter 5 file1', async () => { - const testFile = await TestUtils.loadTestFileAsRawDataFile( - 'ProPresenter', - 'v5 - Be Near.pro5' - ); + const testFile = await TestUtils.loadTestFileAsRawDataFile('ProPresenter', 'v5 - Be Near.pro5'); expect(inputConverter.extractSongData(testFile)).toEqual({ fileName: testFile.name, @@ -87,8 +81,7 @@ describe('InputTypeProPresenter5', () => { }, { title: 'Bridge 1', - lyrics: - 'For dark is light to You\nDepths are Height to you\nFar is near\nBut Lord I need to hear from You', + lyrics: 'For dark is light to You\nDepths are Height to you\nFar is near\nBut Lord I need to hear from You', }, { title: 'Chorus', @@ -119,10 +112,7 @@ describe('InputTypeProPresenter5', () => { }); it('should get a song from a ProPresenter 5 file2', async () => { - const testFile = await TestUtils.loadTestFileAsRawDataFile( - 'ProPresenter', - 'v5 - Give Us Clean Hands.pro5' - ); + const testFile = await TestUtils.loadTestFileAsRawDataFile('ProPresenter', 'v5 - Give Us Clean Hands.pro5'); expect(inputConverter.extractSongData(testFile)).toEqual({ fileName: testFile.name, @@ -150,13 +140,11 @@ describe('InputTypeProPresenter5', () => { }, { title: 'Pre-Chorus', - lyrics: - 'Give us clean hands\nGive us pure hearts\nLet us not lift our\nSouls to another', + lyrics: 'Give us clean hands\nGive us pure hearts\nLet us not lift our\nSouls to another', }, { title: 'Chorus', - lyrics: - 'Oh God let us be\nA generation that seeks\nThat seeks Your face\nOh God of Jacob', + lyrics: 'Oh God let us be\nA generation that seeks\nThat seeks Your face\nOh God of Jacob', }, { title: '*blank*', @@ -167,14 +155,9 @@ describe('InputTypeProPresenter5', () => { }); it('should get the expected SLIDES from a ProPresenter 5 file2 when a slide has no title but lyrics', async () => { - const testFile = await TestUtils.loadTestFileAsRawDataFile( - 'ProPresenter', - 'v5 - single-unnamed-slide.pro5' - ); - - expect( - inputConverter.extractSongData(testFile).slides - ).toEqual([ + const testFile = await TestUtils.loadTestFileAsRawDataFile('ProPresenter', 'v5 - single-unnamed-slide.pro5'); + + expect(inputConverter.extractSongData(testFile).slides).toEqual([ { title: '', lyrics: 'We bow our hearts\nWe bend our knees\nOh Spirit come\nMake us humble', diff --git a/src/app/convert/inputs/input-type-propresenter6.spec.ts b/src/app/convert/inputs/input-type-propresenter6.spec.ts index 311fdc6..28c88d2 100644 --- a/src/app/convert/inputs/input-type-propresenter6.spec.ts +++ b/src/app/convert/inputs/input-type-propresenter6.spec.ts @@ -47,19 +47,13 @@ describe('InputTypeProPresenter6', () => { describe('extractSongData()', () => { it('should get a TITLE from the file name when the file does not have a CCLISongTitle', async () => { - const testFile = await TestUtils.loadTestFileAsRawDataFile( - 'ProPresenter', - 'v6 - Be Near.pro6' - ); + const testFile = await TestUtils.loadTestFileAsRawDataFile('ProPresenter', 'v6 - Be Near.pro6'); testFile.dataAsString = testFile.dataAsString.replace('CCLISongTitle="Be Near" ', ''); expect(inputConverter.extractSongData(testFile).title).toEqual(testFile.name); }); it('should get a song from a ProPresenter 6 file1', async () => { - const testFile = await TestUtils.loadTestFileAsRawDataFile( - 'ProPresenter', - 'v6 - Be Near.pro6' - ); + const testFile = await TestUtils.loadTestFileAsRawDataFile('ProPresenter', 'v6 - Be Near.pro6'); const songData = inputConverter.extractSongData(testFile); @@ -75,10 +69,7 @@ describe('InputTypeProPresenter6', () => { }); it('should get a song from a ProPresenter 6 file2', async () => { - const testFile = await TestUtils.loadTestFileAsRawDataFile( - 'ProPresenter', - 'v6 - Amazing Grace.pro6' - ); + const testFile = await TestUtils.loadTestFileAsRawDataFile('ProPresenter', 'v6 - Amazing Grace.pro6'); expect(inputConverter.extractSongData(testFile)).toEqual({ fileName: testFile.name, @@ -126,10 +117,7 @@ describe('InputTypeProPresenter6', () => { }); it('should get a song from a ProPresenter 6 file3', async () => { - const testFile = await TestUtils.loadTestFileAsRawDataFile( - 'ProPresenter', - 'v6 - Feature Test.pro6' - ); + const testFile = await TestUtils.loadTestFileAsRawDataFile('ProPresenter', 'v6 - Feature Test.pro6'); expect(inputConverter.extractSongData(testFile)).toEqual({ fileName: testFile.name, @@ -146,10 +134,7 @@ describe('InputTypeProPresenter6', () => { }); it('should get a song from a ProPresenter 6 file2 when a slide has no title but lyrics', async () => { - const testFile = await TestUtils.loadTestFileAsRawDataFile( - 'ProPresenter', - 'v6 - single-unnamed-slide.pro6' - ); + const testFile = await TestUtils.loadTestFileAsRawDataFile('ProPresenter', 'v6 - single-unnamed-slide.pro6'); expect(inputConverter.extractSongData(testFile)).toEqual({ fileName: testFile.name, diff --git a/src/app/convert/inputs/input-type-songpro.spec.ts b/src/app/convert/inputs/input-type-songpro.spec.ts index 1251023..a8b4fc9 100644 --- a/src/app/convert/inputs/input-type-songpro.spec.ts +++ b/src/app/convert/inputs/input-type-songpro.spec.ts @@ -43,8 +43,7 @@ describe('InputTypeSongPro', () => { slides: [ { title: 'Verse 1', - lyrics: - "Climb a-board \nI've been waiting for you \nClimb a-board \nYou'll be safe in here", + lyrics: "Climb a-board \nI've been waiting for you \nClimb a-board \nYou'll be safe in here", }, { title: 'Chorus 1', @@ -68,31 +67,26 @@ describe('InputTypeSongPro', () => { { name: 'difficulty', value: '0' }, { name: 'spotify', - value: - 'https://open.spotify.com/track/66FSV5dLK5sNLZ00IfHxfD?si=rQq390e7TcKTxdP9yofslw', + value: 'https://open.spotify.com/track/66FSV5dLK5sNLZ00IfHxfD?si=rQq390e7TcKTxdP9yofslw', }, { name: 'order', value: '4' }, ], slides: [ { title: 'Verse 1', - lyrics: - "I see a bad moon a-rising\nI see trouble on the way\nI see earth-quakes and lightnin'\nI see bad times to-day", + lyrics: "I see a bad moon a-rising\nI see trouble on the way\nI see earth-quakes and lightnin'\nI see bad times to-day", }, { title: 'Chorus 1', - lyrics: - "Don't go 'round tonight\nIt's bound to take your life\nThere's a bad moon on the rise", + lyrics: "Don't go 'round tonight\nIt's bound to take your life\nThere's a bad moon on the rise", }, { title: 'Verse 2', - lyrics: - 'I hear hurri-canes a-blowing\nI know the end is coming soon\nI fear rivers over flowing\nI hear the voice of rage and ruin', + lyrics: 'I hear hurri-canes a-blowing\nI know the end is coming soon\nI fear rivers over flowing\nI hear the voice of rage and ruin', }, { title: 'Chorus 2', - lyrics: - "Don't go 'round tonight\nIt's bound to take your life\nThere's a bad moon on the rise", + lyrics: "Don't go 'round tonight\nIt's bound to take your life\nThere's a bad moon on the rise", }, { title: 'Verse 3', @@ -101,13 +95,11 @@ describe('InputTypeSongPro', () => { }, { title: 'Chorus 3', - lyrics: - "Well don't go 'round tonight\nIt's bound to take your life\nThere's a bad moon on the rise", + lyrics: "Well don't go 'round tonight\nIt's bound to take your life\nThere's a bad moon on the rise", }, { title: 'Chorus 4', - lyrics: - "Don't go 'round tonight\nIt's bound to take your life\nThere's a bad moon on the rise", + lyrics: "Don't go 'round tonight\nIt's bound to take your life\nThere's a bad moon on the rise", }, ], }); diff --git a/src/app/convert/inputs/input-type-songshowplus7.spec.ts b/src/app/convert/inputs/input-type-songshowplus7.spec.ts index e112cae..24a61df 100644 --- a/src/app/convert/inputs/input-type-songshowplus7.spec.ts +++ b/src/app/convert/inputs/input-type-songshowplus7.spec.ts @@ -57,23 +57,19 @@ describe('InputTypeSongShowPlus7', () => { { title: 'Other', lyrics: '' }, { title: 'Verse 1', - lyrics: - "You are all big and small\nBeautiful\nAnd wonderful\nTo trust in grace through faith\nBut I'm asking to taste", + lyrics: "You are all big and small\nBeautiful\nAnd wonderful\nTo trust in grace through faith\nBut I'm asking to taste", }, { title: 'Verse 2', - lyrics: - 'For dark is light to You\nDepths are height to You\nFar is near\nBut Lord I need to hear from You', + lyrics: 'For dark is light to You\nDepths are height to You\nFar is near\nBut Lord I need to hear from You', }, { title: 'Verse 3', - lyrics: - 'Your fullness is mine\nRevelation divine\nBut oh to taste\nTo know much more than a page\nTo feel Your embrace', + lyrics: 'Your fullness is mine\nRevelation divine\nBut oh to taste\nTo know much more than a page\nTo feel Your embrace', }, { title: 'Verse 4', - lyrics: - 'For dark is light to You\nDepths are height to You\nFar is near\nBut Lord I need to hear from You', + lyrics: 'For dark is light to You\nDepths are height to You\nFar is near\nBut Lord I need to hear from You', }, { title: 'Ending', @@ -90,26 +86,11 @@ describe('InputTypeSongShowPlus7', () => { fileName: testFile.name, title: 'Give Us Clean Hands', info: [ - { - name: 'Author', - value: 'Hall, Charlie', - }, - { - name: 'Copyright', - value: '2000 worshiptogether.com songs', - }, - { - name: 'CCLI', - value: '2060208', - }, - { - name: 'Key', - value: 'Ab', - }, - { - name: 'Topics', - value: 'Prayer | Repentance', - }, + { name: 'Author', value: 'Hall, Charlie' }, + { name: 'Copyright', value: '2000 worshiptogether.com songs' }, + { name: 'CCLI', value: '2060208' }, + { name: 'Key', value: 'Ab' }, + { name: 'Topics', value: 'Prayer | Repentance' }, ], slides: [ { @@ -138,14 +119,8 @@ describe('InputTypeSongShowPlus7', () => { fileName: testFile.name, title: 'Jesus Saves (2)', info: [ - { - name: 'Author', - value: 'Eddie James', - }, - { - name: 'Copyright', - value: '© Fresh Wine Publishing', - }, + { name: 'Author', value: 'Eddie James' }, + { name: 'Copyright', value: '© Fresh Wine Publishing' }, ], slides: [ { @@ -185,7 +160,7 @@ describe('InputTypeSongShowPlus7', () => { }, { title: 'Vamp 1', - lyrics: "Jesus saves (repeat) Hallelujah (repeat)", + lyrics: 'Jesus saves (repeat) Hallelujah (repeat)', }, ], }); @@ -198,26 +173,11 @@ describe('InputTypeSongShowPlus7', () => { fileName: testFile.name, title: 'You Are (2)', info: [ - { - name: 'Author', - value: 'Jobe, Caleb | Cohen, Ezra | Hesami, Josh | Trimble, Paul', - }, - { - name: 'Copyright', - value: '2010 CFN Music', - }, - { - name: 'CCLI', - value: '5715921', - }, - { - name: 'Key', - value: 'C', - }, - { - name: 'Topics', - value: 'Appreciation | Breakthrough | Christ | Declaration | Jesus', - }, + { name: 'Author', value: 'Jobe, Caleb | Cohen, Ezra | Hesami, Josh | Trimble, Paul' }, + { name: 'Copyright', value: '2010 CFN Music' }, + { name: 'CCLI', value: '5715921' }, + { name: 'Key', value: 'C' }, + { name: 'Topics', value: 'Appreciation | Breakthrough | Christ | Declaration | Jesus' }, ], slides: [ { diff --git a/src/app/convert/outputs/output-type-json.spec.ts b/src/app/convert/outputs/output-type-json.spec.ts index a4eccc4..1e040ff 100644 --- a/src/app/convert/outputs/output-type-json.spec.ts +++ b/src/app/convert/outputs/output-type-json.spec.ts @@ -15,11 +15,7 @@ describe('OutputTypeJSON', () => { it('should output a JSON object identical to the input, but without the filename property', () => { const song = structuredClone(mockSongObjects[0]!); - const expectedJsonString = JSON.stringify( - { title: song.title, info: song.info, slides: song.slides }, - null, - 2 - ); + const expectedJsonString = JSON.stringify({ title: song.title, info: song.info, slides: song.slides }, null, 2); expect(outputType.convertToType(song)).toEqual({ songData: song, diff --git a/src/app/convert/outputs/output-type-openlyrics.spec.ts b/src/app/convert/outputs/output-type-openlyrics.spec.ts index 55ee10d..bab65d2 100644 --- a/src/app/convert/outputs/output-type-openlyrics.spec.ts +++ b/src/app/convert/outputs/output-type-openlyrics.spec.ts @@ -18,9 +18,7 @@ describe('OutputTypeOpenLyrics', () => { const song = structuredClone(mockEmptySong); const outputFile = outputType.convertToType(song); - const normalizedOutput = TestUtils.normalizeOpenLyricsStringForTesting( - outputFile.outputContent - ); + const normalizedOutput = TestUtils.normalizeOpenLyricsStringForTesting(outputFile.outputContent); const normalizedExpectation = TestUtils.normalizeOpenLyricsStringForTesting( ` @@ -36,9 +34,7 @@ describe('OutputTypeOpenLyrics', () => { ); expect(outputFile.songData).withContext('original song data').toEqual(song); - expect(outputFile.fileName) - .withContext('file name') - .toEqual(`${song.fileName}.${outputType.fileExt}`); + expect(outputFile.fileName).withContext('file name').toEqual(`${song.fileName}.${outputType.fileExt}`); expect(normalizedOutput).withContext('file content').toEqual(normalizedExpectation); }); @@ -46,9 +42,7 @@ describe('OutputTypeOpenLyrics', () => { const song = structuredClone(mockSongObjects[0]!); const outputFile = outputType.convertToType(song); - const normalizedOutput = TestUtils.normalizeOpenLyricsStringForTesting( - outputFile.outputContent - ); + const normalizedOutput = TestUtils.normalizeOpenLyricsStringForTesting(outputFile.outputContent); const normalizedExpectation = TestUtils.normalizeOpenLyricsStringForTesting( ` @@ -79,9 +73,7 @@ describe('OutputTypeOpenLyrics', () => { ); expect(outputFile.songData).withContext('original song data').toEqual(song); - expect(outputFile.fileName) - .withContext('file name') - .toEqual(`${song.fileName}.${outputType.fileExt}`); + expect(outputFile.fileName).withContext('file name').toEqual(`${song.fileName}.${outputType.fileExt}`); expect(normalizedOutput).withContext('file content').toEqual(normalizedExpectation); }); @@ -89,9 +81,7 @@ describe('OutputTypeOpenLyrics', () => { const song = structuredClone(mockSongObjects[1]!); const outputFile = outputType.convertToType(song); - const normalizedOutput = TestUtils.normalizeOpenLyricsStringForTesting( - outputFile.outputContent - ); + const normalizedOutput = TestUtils.normalizeOpenLyricsStringForTesting(outputFile.outputContent); const normalizedExpectation = TestUtils.normalizeOpenLyricsStringForTesting( ` @@ -122,9 +112,7 @@ describe('OutputTypeOpenLyrics', () => { ); expect(outputFile.songData).withContext('original song data').toEqual(song); - expect(outputFile.fileName) - .withContext('file name') - .toEqual(`${song.fileName}.${outputType.fileExt}`); + expect(outputFile.fileName).withContext('file name').toEqual(`${song.fileName}.${outputType.fileExt}`); expect(normalizedOutput).withContext('file content').toEqual(normalizedExpectation); }); @@ -132,9 +120,7 @@ describe('OutputTypeOpenLyrics', () => { const song = structuredClone(mockSongObjects[2]!); const outputFile = outputType.convertToType(song); - const normalizedOutput = TestUtils.normalizeOpenLyricsStringForTesting( - outputFile.outputContent - ); + const normalizedOutput = TestUtils.normalizeOpenLyricsStringForTesting(outputFile.outputContent); const normalizedExpectation = TestUtils.normalizeOpenLyricsStringForTesting( ` @@ -181,9 +167,7 @@ describe('OutputTypeOpenLyrics', () => { ); expect(outputFile.songData).withContext('original song data').toEqual(song); - expect(outputFile.fileName) - .withContext('file name') - .toEqual(`${song.fileName}.${outputType.fileExt}`); + expect(outputFile.fileName).withContext('file name').toEqual(`${song.fileName}.${outputType.fileExt}`); expect(normalizedOutput).withContext('file content').toEqual(normalizedExpectation); }); @@ -191,9 +175,7 @@ describe('OutputTypeOpenLyrics', () => { const song = structuredClone(mockSongObjects[3]!); const outputFile = outputType.convertToType(song); - const normalizedOutput = TestUtils.normalizeOpenLyricsStringForTesting( - outputFile.outputContent - ); + const normalizedOutput = TestUtils.normalizeOpenLyricsStringForTesting(outputFile.outputContent); const normalizedExpectation = TestUtils.normalizeOpenLyricsStringForTesting( ` @@ -258,9 +240,7 @@ describe('OutputTypeOpenLyrics', () => { ); expect(outputFile.songData).withContext('original song data').toEqual(song); - expect(outputFile.fileName) - .withContext('file name') - .toEqual(`${song.fileName}.${outputType.fileExt}`); + expect(outputFile.fileName).withContext('file name').toEqual(`${song.fileName}.${outputType.fileExt}`); expect(normalizedOutput).withContext('file content').toEqual(normalizedExpectation); }); }); diff --git a/src/app/convert/outputs/output-type-plain-text.spec.ts b/src/app/convert/outputs/output-type-plain-text.spec.ts index 4c76c7e..230bbc7 100644 --- a/src/app/convert/outputs/output-type-plain-text.spec.ts +++ b/src/app/convert/outputs/output-type-plain-text.spec.ts @@ -47,7 +47,7 @@ describe('OutputTypePlainText', () => { it('should not include info with blank values', () => { const song = structuredClone(mockSongObjects[0]!); - song.info.push({name: 'Test Blank', value: ''}) + song.info.push({ name: 'Test Blank', value: '' }); expect(outputType.convertToType(song)).toEqual({ songData: song, @@ -80,7 +80,7 @@ describe('OutputTypePlainText', () => { it('should not include slides with blank lyrics', () => { const song = structuredClone(mockSongObjects[0]!); - song.slides.push({title: 'Test Blank', lyrics: ''}) + song.slides.push({ title: 'Test Blank', lyrics: '' }); expect(outputType.convertToType(song)).toEqual({ songData: song, diff --git a/src/app/convert/outputs/output-type-propresenter5.spec.ts b/src/app/convert/outputs/output-type-propresenter5.spec.ts index af07405..c8073b6 100644 --- a/src/app/convert/outputs/output-type-propresenter5.spec.ts +++ b/src/app/convert/outputs/output-type-propresenter5.spec.ts @@ -17,17 +17,10 @@ describe('OutputTypePropresenter5', () => { const song = structuredClone(mockEmptySong); const outputFile = outputType.convertToType(song); - const emptySongFile = await TestUtils.loadTestFileAsRawDataFile( - 'ProPresenter', - 'v5 - empty-song.pro5' - ); - - const normalizedOutput = TestUtils.normalizeProPresenterStringForTesting( - outputFile.outputContent - ); - const normalizedExpectation = TestUtils.normalizeProPresenterStringForTesting( - emptySongFile.dataAsString - ); + const emptySongFile = await TestUtils.loadTestFileAsRawDataFile('ProPresenter', 'v5 - empty-song.pro5'); + + const normalizedOutput = TestUtils.normalizeProPresenterStringForTesting(outputFile.outputContent); + const normalizedExpectation = TestUtils.normalizeProPresenterStringForTesting(emptySongFile.dataAsString); expect(outputFile.songData).toEqual(song); expect(outputFile.fileName).toEqual(`${song.fileName}.${outputType.fileExt}`); @@ -38,17 +31,10 @@ describe('OutputTypePropresenter5', () => { const song = structuredClone(mockSongObjects[2]!); const outputFile = outputType.convertToType(song); - const songFile = await TestUtils.loadTestFileAsRawDataFile( - 'ProPresenter', - 'v5 - Be Near (2).pro5' - ); - - const normalizedOutput = TestUtils.normalizeProPresenterStringForTesting( - outputFile.outputContent - ); - const normalizedExpectation = TestUtils.normalizeProPresenterStringForTesting( - songFile.dataAsString - ); + const songFile = await TestUtils.loadTestFileAsRawDataFile('ProPresenter', 'v5 - Be Near (2).pro5'); + + const normalizedOutput = TestUtils.normalizeProPresenterStringForTesting(outputFile.outputContent); + const normalizedExpectation = TestUtils.normalizeProPresenterStringForTesting(songFile.dataAsString); expect(outputFile.songData).toEqual(song); expect(outputFile.fileName).toEqual(`${song.fileName}.${outputType.fileExt}`); diff --git a/src/app/convert/outputs/output-type-propresenter6.spec.ts b/src/app/convert/outputs/output-type-propresenter6.spec.ts index 9e115c8..2fb6f6e 100644 --- a/src/app/convert/outputs/output-type-propresenter6.spec.ts +++ b/src/app/convert/outputs/output-type-propresenter6.spec.ts @@ -17,17 +17,10 @@ describe('OutputTypePropresenter6', () => { const song = structuredClone(mockEmptySong); const outputFile = outputType.convertToType(song); - const emptySongFile = await TestUtils.loadTestFileAsRawDataFile( - 'ProPresenter', - 'v6 - empty-song.pro6' - ); - - const normalizedOutput = TestUtils.normalizeProPresenterStringForTesting( - outputFile.outputContent - ); - const normalizedExpectation = TestUtils.normalizeProPresenterStringForTesting( - emptySongFile.dataAsString - ); + const emptySongFile = await TestUtils.loadTestFileAsRawDataFile('ProPresenter', 'v6 - empty-song.pro6'); + + const normalizedOutput = TestUtils.normalizeProPresenterStringForTesting(outputFile.outputContent); + const normalizedExpectation = TestUtils.normalizeProPresenterStringForTesting(emptySongFile.dataAsString); expect(outputFile.songData).toEqual(song); expect(outputFile.fileName).toEqual(`${song.fileName}.${outputType.fileExt}`); @@ -38,17 +31,10 @@ describe('OutputTypePropresenter6', () => { const song = structuredClone(mockSongObjects[2]!); const outputFile = outputType.convertToType(song); - const songFile = await TestUtils.loadTestFileAsRawDataFile( - 'ProPresenter', - 'v6 - Be Near (2).pro6' - ); - - const normalizedOutput = TestUtils.normalizeProPresenterStringForTesting( - outputFile.outputContent - ); - const normalizedExpectation = TestUtils.normalizeProPresenterStringForTesting( - songFile.dataAsString - ); + const songFile = await TestUtils.loadTestFileAsRawDataFile('ProPresenter', 'v6 - Be Near (2).pro6'); + + const normalizedOutput = TestUtils.normalizeProPresenterStringForTesting(outputFile.outputContent); + const normalizedExpectation = TestUtils.normalizeProPresenterStringForTesting(songFile.dataAsString); expect(outputFile.songData).toEqual(song); expect(outputFile.fileName).toEqual(`${song.fileName}.${outputType.fileExt}`); diff --git a/src/app/convert/parser/parser.service.spec.ts b/src/app/convert/parser/parser.service.spec.ts index 2a7fac3..9aebf8a 100644 --- a/src/app/convert/parser/parser.service.spec.ts +++ b/src/app/convert/parser/parser.service.spec.ts @@ -91,7 +91,7 @@ describe('ParserService', () => { }); describe('detectInputTypeAndGetConverter()', () => { - it('should return undefined when a file type cannot be detected', async() => { + it('should return undefined when a file type cannot be detected', async () => { const testFile = await TestUtils.loadTestFileAsRawDataFile('image', 'mr-bean.png'); expect(service.detectInputTypeAndGetConverter(testFile)).toEqual(undefined); }); @@ -102,9 +102,7 @@ describe('ParserService', () => { const expectedClass = service.inputConverters.find((c) => { return c instanceof InputTypePlainText; }); - expect(service.detectInputTypeAndGetConverter(testFile)).toEqual( - expectedClass - ); + expect(service.detectInputTypeAndGetConverter(testFile)).toEqual(expectedClass); }); it('should properly detect a ProPresenter5 file', () => { @@ -128,9 +126,7 @@ describe('ParserService', () => { const expectedClass = service.inputConverters.find((c) => { return c instanceof InputTypeJSON; }); - expect(service.detectInputTypeAndGetConverter(testFile)).toEqual( - expectedClass - ); + expect(service.detectInputTypeAndGetConverter(testFile)).toEqual(expectedClass); }); }); }); diff --git a/src/app/convert/shared/utils.spec.ts b/src/app/convert/shared/utils.spec.ts index 3afb6e3..9d53c34 100644 --- a/src/app/convert/shared/utils.spec.ts +++ b/src/app/convert/shared/utils.spec.ts @@ -5,10 +5,7 @@ describe('Utils', () => { it('should only combine arrays of objects together when all values of the same key are unique', () => { const obj1 = [{ foo: 'fooVal' }]; const obj2 = [{ foo: 'barVal' }]; - expect(Utils.mergeArraysByProp(obj1, obj2, 'foo')).toEqual([ - { foo: 'fooVal' }, - { foo: 'barVal' }, - ]); + expect(Utils.mergeArraysByProp(obj1, obj2, 'foo')).toEqual([{ foo: 'fooVal' }, { foo: 'barVal' }]); }); it('should merge identical arrays of objects together, overwriting values for the same key', () => { @@ -40,12 +37,8 @@ describe('Utils', () => { expect(Utils.normalizeLineEndings('\r\n')).withContext('\\r\\n => \\n').toEqual('\n'); //Multiple instances - expect(Utils.normalizeLineEndings('\n\r\n\r')) - .withContext('\\n\\r\\n\\r => \\n\\n') - .toEqual('\n\n'); - expect(Utils.normalizeLineEndings('\r\n\r\n')) - .withContext('\\r\\n\\r\\n => \\n\\n') - .toEqual('\n\n'); + expect(Utils.normalizeLineEndings('\n\r\n\r')).withContext('\\n\\r\\n\\r => \\n\\n').toEqual('\n\n'); + expect(Utils.normalizeLineEndings('\r\n\r\n')).withContext('\\r\\n\\r\\n => \\n\\n').toEqual('\n\n'); //No chages expected here expect(Utils.normalizeLineEndings('\n')).withContext('\\n => \\n').toEqual('\n'); diff --git a/src/app/drag-and-drop-files/drag-and-drop-files.directive.spec.ts b/src/app/drag-and-drop-files/drag-and-drop-files.directive.spec.ts index d6b5606..a5da026 100644 --- a/src/app/drag-and-drop-files/drag-and-drop-files.directive.spec.ts +++ b/src/app/drag-and-drop-files/drag-and-drop-files.directive.spec.ts @@ -134,15 +134,15 @@ describe('DragAndDropFilesDirective', () => { //It'd difficult to test the specific properties of a File object, // so as long as we have the correct number of files with the correct names we are good to go - expect(outputFiles.length).withContext('Number of emitted files').toEqual(3) - expect(outputFiles.item(0)?.name).withContext('Emitted file #1 name').toEqual('UPPERCASE.WITH.DOTS.TXT') - expect(outputFiles.item(1)?.name).withContext('Emitted file #2 name').toEqual('no-extension') - expect(outputFiles.item(2)?.name).withContext('Emitted file #3 name').toEqual('lowercase-file.pro5') + expect(outputFiles.length).withContext('Number of emitted files').toEqual(3); + expect(outputFiles.item(0)?.name).withContext('Emitted file #1 name').toEqual('UPPERCASE.WITH.DOTS.TXT'); + expect(outputFiles.item(1)?.name).withContext('Emitted file #2 name').toEqual('no-extension'); + expect(outputFiles.item(2)?.name).withContext('Emitted file #3 name').toEqual('lowercase-file.pro5'); done(); }); - directiveInstance.document.dispatchEvent(new DragEvent('drop', { cancelable: true, dataTransfer: dt })) + directiveInstance.document.dispatchEvent(new DragEvent('drop', { cancelable: true, dataTransfer: dt })); fixture.detectChanges(); }); });