Advertisement
CLooker

Untitled

Feb 28th, 2018
383
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. describe("`lateMessage`", () => {
  2.     let fakeKonversation, localView, message;
  3.  
  4.     beforeEach(() => {
  5.       fakeKonversation = Konversation.extend({
  6.         chat_presenter: jest.fn(message => ({
  7.           render: jest.fn(param => ({
  8.             el: "DIV"
  9.           }))
  10.         }))
  11.       });
  12.       localView = new fakeKonversation(params);
  13.       localView.$el.append(`<div class=chat-messages></div>`);
  14.     });
  15.  
  16.     describe("should do stuff if `view.late` is `true`", () => {
  17.       it("should call `chat_presenter` with `message`", () => {
  18.         localView.late = true;
  19.         localView.lateMessage("This is a late message");
  20.         expect(localView.chat_presenter.mock.calls.length).toBe(1);
  21.       });
  22.     });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement