Skip to content

Instantly share code, notes, and snippets.

@benjamincharity
Created December 17, 2016 18:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benjamincharity/90063826b4a37fae797ced647654525a to your computer and use it in GitHub Desktop.
Save benjamincharity/90063826b4a37fae797ced647654525a to your computer and use it in GitHub Desktop.
import { TestBed, inject } from '@angular/core/testing';
import { ConvertStatusPipe } from './convert-status.pipe';
import { ConversationStatus } from '@remedy/models';
import { LoggingService } from '../core/services/logging.service';
import { LoggingServiceMock } from './../core/services/logging.service.mock';
describe(`ConvertStatusPipe`, () => {
let pipe;
beforeEach(() => TestBed.configureTestingModule({
providers: [
ConvertStatusPipe,
{
provide: LoggingService,
useClass: LoggingServiceMock,
},
],
}));
beforeEach(inject([ConvertStatusPipe], p => {
pipe = p;
}));
it(`transforms '0' to 'new'`, () => {
const actual = pipe.transform(0, ConversationStatus);
const expected = ConversationStatus[0];
expect(actual).toBe(expected);
});
it(`should log an error if the output is incorrect`, () => {
pipe.transform('closed');
expect(pipe.loggingService.warn).toHaveBeenCalled();
});
});
@mac10046
Copy link

Thanx bro - it helped and worked for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment