Skip to content

Commit 09e0296

Browse files
committed
Added new test case.
1 parent 3ea0b7d commit 09e0296

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

packages/ckeditor5-emoji/tests/emojirepository.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,32 @@ describe( 'EmojiRepository', () => {
157157
await editor2.destroy();
158158
} );
159159

160+
it( 'should fetch the emoji database version 16 only once even if first download has failed', async () => {
161+
const { editor: editor1, domElement: domElement1 } = await createTestEditor( resolve => {
162+
resolve( new Response( null, { status: 500 } ) );
163+
} );
164+
165+
const { editor: editor2, domElement: domElement2 } = await createTestEditor( resolve => {
166+
const response = JSON.stringify( [
167+
{ annotation: 'neutral face', group: 0 },
168+
{ annotation: 'unamused face', group: 0 }
169+
] );
170+
171+
resolve( new Response( response ) );
172+
} );
173+
174+
expect( fetchStub.calledOnce ).to.equal( true );
175+
176+
const database = EmojiRepository._database[ 16 ];
177+
178+
expect( database ).to.deep.equal( [] );
179+
180+
domElement1.remove();
181+
domElement2.remove();
182+
await editor1.destroy();
183+
await editor2.destroy();
184+
} );
185+
160186
it( 'should filter out group "2" from the fetched emoji database', async () => {
161187
const { editor, domElement } = await createTestEditor( resolve => {
162188
const response = JSON.stringify( [

0 commit comments

Comments
 (0)