mirror of
https://github.com/codex-team/editor.js
synced 2024-05-03 07:03:47 +02:00
test: rewrite cases after review
This commit is contained in:
parent
b5f7fb6d96
commit
3d095821ca
|
@ -0,0 +1,9 @@
|
|||
describe('Operation Executor', () => {
|
||||
it('should apply an Operation from OperationReceived event on Document State', () => {
|
||||
console.log('todo');
|
||||
});
|
||||
|
||||
it('should emit OperationApplied event on receiving new operation', () => {
|
||||
console.log('todo');
|
||||
});
|
||||
});
|
|
@ -0,0 +1,53 @@
|
|||
describe('Operation Manager', () => {
|
||||
/**
|
||||
* Mock Private EventBus
|
||||
*
|
||||
*
|
||||
*/
|
||||
describe('Local changes', () => {
|
||||
it('should put new operation to the end of Pending OPs queue', () => {
|
||||
console.log('todo');
|
||||
});
|
||||
|
||||
it('should send first operation from the Pending OPs queue to the Server', () => {
|
||||
console.log('todo');
|
||||
});
|
||||
|
||||
it('should remove operation from the start of Pending OPs queue after Acknowledgement from the Server', () => {
|
||||
console.log('todo');
|
||||
});
|
||||
|
||||
it('should not send new operation to the Server if it\'s waiting for Acknowledgement from the Server', () => {
|
||||
console.log('todo');
|
||||
});
|
||||
|
||||
it('should receive Acknowledgement from the Server and put Operations from response to the Resolved OPs', () => {
|
||||
console.log('todo');
|
||||
});
|
||||
});
|
||||
|
||||
describe('Received changes', () => {
|
||||
it('should execute Transformer over Pending OPs relative to the received operation and put them back to the Pending OPs', () => {
|
||||
console.log('todo');
|
||||
// Think about how to check changes in the Pending OPs
|
||||
});
|
||||
|
||||
it('should put received operation to the end of Resolved OPs', () => {
|
||||
console.log('todo');
|
||||
});
|
||||
|
||||
it('should emit an OperationReceived event with received operation to the Private EventBus', () => {
|
||||
console.log('todo');
|
||||
});
|
||||
});
|
||||
|
||||
describe('Document Revision', () => {
|
||||
it('should send current Document Revision with a new Operation', () => {
|
||||
console.log('todo');
|
||||
});
|
||||
|
||||
it('should set current Document Revision from received Operation', () => {
|
||||
console.log('todo');
|
||||
});
|
||||
});
|
||||
});
|
|
@ -0,0 +1,25 @@
|
|||
describe('Operation Observer', () => {
|
||||
/**
|
||||
* Mock Public EventBus
|
||||
* Mock previous state in Document State Store
|
||||
*
|
||||
* Act - emulate Change Event at Public EventBus
|
||||
*
|
||||
* Expect - Private EventBus got correct operation
|
||||
*/
|
||||
it('should create INSERT operation when it receives a change event after adding data', () => {
|
||||
console.log('todo');
|
||||
});
|
||||
|
||||
it('should create DELETE operation when it receives a change event after removing data', () => {
|
||||
console.log('todo');
|
||||
});
|
||||
|
||||
it('should create DELETE and INSERT operations when it receives a change event after replacing data', () => {
|
||||
console.log('todo');
|
||||
});
|
||||
|
||||
it('should put new Document State to the store', () => {
|
||||
console.log('todo');
|
||||
});
|
||||
});
|
|
@ -1,9 +0,0 @@
|
|||
describe('Operation Executor', () => {
|
||||
it('should change document state with received operation', () => {
|
||||
console.log('todo');
|
||||
});
|
||||
|
||||
it('should fire \'OperationApplied\' event on receiving new operation', () => {
|
||||
console.log('todo');
|
||||
});
|
||||
});
|
|
@ -1,29 +0,0 @@
|
|||
describe('Operation Manager', () => {
|
||||
describe('Local changes', () => {
|
||||
it('should put new operation to the Pending OPs until sending to the server', () => {
|
||||
console.log('todo');
|
||||
});
|
||||
|
||||
it('should remove operation from the Pending OPs after sending to the server', () => {
|
||||
console.log('todo');
|
||||
});
|
||||
|
||||
it('should put received operation with acknowledgement to the Resolved OPs', () => {
|
||||
console.log('todo');
|
||||
});
|
||||
});
|
||||
|
||||
describe('Received changes', () => {
|
||||
it('should transform Pending OPs relative to the received operation', () => {
|
||||
console.log('todo');
|
||||
});
|
||||
|
||||
it('should put received operation to the private Event Bus', () => {
|
||||
console.log('todo');
|
||||
});
|
||||
|
||||
it('should put received operation to the Resolved OPs', () => {
|
||||
console.log('todo');
|
||||
});
|
||||
});
|
||||
});
|
|
@ -1,5 +0,0 @@
|
|||
describe('Operation Observer', () => {
|
||||
it('should create operation by changes event from the public event bus', () => {
|
||||
console.log('todo');
|
||||
});
|
||||
});
|
|
@ -0,0 +1,41 @@
|
|||
describe('Transformer', () => {
|
||||
describe('Block Indices', () => {
|
||||
it('should not transform the first Operation which index is less than index of the second Operation', () => {
|
||||
console.log('todo');
|
||||
});
|
||||
|
||||
it('should transform the first Operation which index is more than index of the second Operation', () => {
|
||||
console.log('todo');
|
||||
});
|
||||
});
|
||||
|
||||
describe('Symbol Indices', () => {
|
||||
it('should not transform the first Operation which index is less than index of the second Operation', () => {
|
||||
console.log('todo');
|
||||
});
|
||||
|
||||
it('should transform the first Operation which index is more than index of the second Operation', () => {
|
||||
console.log('todo');
|
||||
});
|
||||
});
|
||||
|
||||
describe('Mixed Indices', () => {
|
||||
it('should not transform the first Operation which block index is less than block index of the second Operation', () => {
|
||||
console.log('todo');
|
||||
});
|
||||
|
||||
it('should transform the first Operation which block index is more than block index of the second Operation', () => {
|
||||
console.log('todo');
|
||||
});
|
||||
});
|
||||
|
||||
describe('Inverting Operation', () => {
|
||||
it('should invert INSERT Operation to DELETE Operation', () => {
|
||||
console.log('todo');
|
||||
});
|
||||
|
||||
it('should invert DELETE Operation to INSERT Operation', () => {
|
||||
console.log('todo');
|
||||
});
|
||||
});
|
||||
});
|
|
@ -1,5 +0,0 @@
|
|||
describe('Transformer', () => {
|
||||
it('should transform the operation relative to the previous one', () => {
|
||||
console.log('todo');
|
||||
});
|
||||
});
|
|
@ -1,4 +1,7 @@
|
|||
describe('Undo Redo Manager', () => {
|
||||
/**
|
||||
* Need to draw work flow before describing tests
|
||||
*/
|
||||
it('should do \'UNDO\' operation', () => {
|
||||
console.log('todo');
|
||||
});
|
Loading…
Reference in a new issue