-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
JoshuaHamann
committed
Apr 7, 2020
1 parent
c9ec108
commit 5a531c4
Showing
2 changed files
with
59 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,69 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { NoteCardComponent } from './note-card.component'; | ||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; | ||
import { FormsModule } from '@angular/forms'; | ||
import { MatButtonModule } from '@angular/material/button'; | ||
import { MatCardModule } from '@angular/material/card'; | ||
import { MatOptionModule } from '@angular/material/core'; | ||
import { MatDividerModule } from '@angular/material/divider'; | ||
import { MatExpansionModule } from '@angular/material/expansion'; | ||
import { MatFormFieldModule } from '@angular/material/form-field'; | ||
import { MatInputModule } from '@angular/material/input'; | ||
import { MatListModule } from '@angular/material/list'; | ||
import { MatRadioModule } from '@angular/material/radio'; | ||
import { MatSelectModule } from '@angular/material/select'; | ||
import { MatTooltipModule } from '@angular/material/tooltip'; | ||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; | ||
import { RouterTestingModule } from '@angular/router/testing'; | ||
import { Observable } from 'rxjs'; | ||
import { MockNoteService } from '../../testing/note.service.mock'; | ||
import { Note } from './note'; | ||
import { NoteCardComponent } from './note-card.component'; | ||
import { NoteService } from './note.service'; | ||
import { MatIconModule } from '@angular/material/icon'; | ||
import { splitClasses } from '@angular/compiler'; | ||
|
||
const COMMON_IMPORTS: any[] = [ | ||
FormsModule, | ||
MatCardModule, | ||
MatFormFieldModule, | ||
MatSelectModule, | ||
MatOptionModule, | ||
MatButtonModule, | ||
MatInputModule, | ||
MatExpansionModule, | ||
MatTooltipModule, | ||
MatListModule, | ||
MatDividerModule, | ||
MatRadioModule, | ||
MatIconModule, | ||
BrowserAnimationsModule, | ||
RouterTestingModule, | ||
]; | ||
|
||
describe('NoteCardComponent', () => { | ||
let component: NoteCardComponent; | ||
let noteCard: NoteCardComponent; | ||
let fixture: ComponentFixture<NoteCardComponent>; | ||
|
||
beforeEach(async(() => { | ||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [ | ||
BrowserAnimationsModule, | ||
MatCardModule | ||
], | ||
declarations: [ NoteCardComponent ] | ||
}) | ||
.compileComponents(); | ||
imports: [COMMON_IMPORTS], | ||
declarations: [NoteCardComponent], | ||
providers: [{ provide: NoteService, useValue: new MockNoteService() }] | ||
}); | ||
}); | ||
|
||
beforeEach(async(() => { | ||
TestBed.compileComponents().then(() => { | ||
fixture = TestBed.createComponent(NoteCardComponent); | ||
noteCard = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
})); | ||
/* Create a mock note here and create some more tests | ||
beforeEach(() => { | ||
fixture = TestBed.createComponent(NoteCardComponent); | ||
component = fixture.componentInstance; | ||
component.note = { | ||
_id: '588935f57546a2daea44de7c', | ||
name: 'Rachael Johnson', | ||
officeID: '1310', | ||
email: '[email protected]', | ||
building: 'Science' | ||
}; | ||
fixture.detectChanges(); | ||
|
||
it('contains all the notes', () => { | ||
expect(noteCard.serverFilteredNotes.length).toBe(3); | ||
}); | ||
*/ | ||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
|
||
it('contains a message \'Spirate pur, Spirate\'', () => { | ||
expect(noteCard.serverFilteredNotes.some((note: Note) => note.message === 'Spirate pur, Spirate')).toBe(true); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters