1- import { expect } from "chai" ;
21import sinon from "sinon" ;
32import Draft , { EditorState , SelectionState } from "draft-js" ;
43import handleNewCodeBlock from "../handleNewCodeBlock" ;
@@ -49,10 +48,10 @@ describe("handleNewCodeBlock", () => {
4948 ) ;
5049 it ( "creates new code block" , ( ) => {
5150 const newEditorState = handleNewCodeBlock ( editorState ) ;
52- expect ( newEditorState ) . not . to . equal ( editorState ) ;
53- expect (
54- Draft . convertToRaw ( newEditorState . getCurrentContent ( ) )
55- ) . to . deep . equal ( afterRawContentState ) ;
51+ expect ( newEditorState ) . not . toEqual ( editorState ) ;
52+ expect ( Draft . convertToRaw ( newEditorState . getCurrentContent ( ) ) ) . toEqual (
53+ afterRawContentState
54+ ) ;
5655 } ) ;
5756 } ;
5857
@@ -61,10 +60,10 @@ describe("handleNewCodeBlock", () => {
6160 } ) ;
6261
6362 describe ( "in code block" , ( ) => {
64- before ( ( ) => {
63+ beforeAll ( ( ) => {
6564 sinon . stub ( Draft , "genKey" ) . returns ( "item2" ) ;
6665 } ) ;
67- after ( ( ) => {
66+ afterAll ( ( ) => {
6867 Draft . genKey . restore ( ) ;
6968 } ) ;
7069 const beforeRawContentState = {
@@ -119,10 +118,10 @@ describe("handleNewCodeBlock", () => {
119118 selection
120119 ) ;
121120 const newEditorState = handleNewCodeBlock ( editorState ) ;
122- expect ( newEditorState ) . not . to . equal ( editorState ) ;
123- expect (
124- Draft . convertToRaw ( newEditorState . getCurrentContent ( ) )
125- ) . to . deep . equal ( afterRawContentState ) ;
121+ expect ( newEditorState ) . not . toEqual ( editorState ) ;
122+ expect ( Draft . convertToRaw ( newEditorState . getCurrentContent ( ) ) ) . toEqual (
123+ afterRawContentState
124+ ) ;
126125 } ) ;
127126 it ( "does not add new line even inside code block" , ( ) => {
128127 const selection = new SelectionState ( {
@@ -138,10 +137,10 @@ describe("handleNewCodeBlock", () => {
138137 selection
139138 ) ;
140139 const newEditorState = handleNewCodeBlock ( editorState ) ;
141- expect ( newEditorState ) . to . equal ( editorState ) ;
142- expect (
143- Draft . convertToRaw ( newEditorState . getCurrentContent ( ) )
144- ) . to . deep . equal ( beforeRawContentState ) ;
140+ expect ( newEditorState ) . toEqual ( editorState ) ;
141+ expect ( Draft . convertToRaw ( newEditorState . getCurrentContent ( ) ) ) . toEqual (
142+ beforeRawContentState
143+ ) ;
145144 } ) ;
146145 } ) ;
147146
@@ -175,10 +174,10 @@ describe("handleNewCodeBlock", () => {
175174 ) ;
176175 it ( "noop" , ( ) => {
177176 const newEditorState = handleNewCodeBlock ( editorState ) ;
178- expect ( newEditorState ) . to . equal ( editorState ) ;
179- expect (
180- Draft . convertToRaw ( newEditorState . getCurrentContent ( ) )
181- ) . to . deep . equal ( rawContentState ) ;
177+ expect ( newEditorState ) . toEqual ( editorState ) ;
178+ expect ( Draft . convertToRaw ( newEditorState . getCurrentContent ( ) ) ) . toEqual (
179+ rawContentState
180+ ) ;
182181 } ) ;
183182 } ) ;
184183} ) ;
0 commit comments