Skip to content

Commit

Permalink
unit tests fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bruno12mota committed Dec 26, 2016
1 parent b4d4fd9 commit 8fee323
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 46 deletions.
10 changes: 5 additions & 5 deletions lib/shared/reducers/page-builder/__tests__/actions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('Page builder page actions', () => {
action: {
type: 'new',
destination: {
id: 'body',
id: 'Body',
position: 0
},
context: {
Expand All @@ -48,14 +48,14 @@ describe('Page builder page actions', () => {

expect(newState.fragments.draft.doc).toEqual({
data: {
body: {
id: 'body',
tag: 'body',
Body: {
id: 'Body',
tag: 'Body',
children: ['0']
},
0: {
id: '0',
parent: 'body',
parent: 'Body',
type: 'TextBox'
}
}
Expand Down
26 changes: 13 additions & 13 deletions lib/shared/reducers/page-builder/__tests__/menu.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ describe('Page builder menu actions', () => {
draft: {
doc: {
data: {
body: {
id: 'body',
tag: 'body',
Body: {
id: 'Body',
tag: 'Body',
children: ['0']
},
0: {
id: '0',
parent: 'body',
parent: 'Body',
tag: 'Section',
children: ['1']
},
Expand Down Expand Up @@ -156,14 +156,14 @@ describe('Page builder menu actions', () => {
draft: {
doc: {
data: {
body: {
id: 'body',
tag: 'body',
Body: {
id: 'Body',
tag: 'Body',
children: ['0']
},
0: {
id: '0',
parent: 'body',
parent: 'Body',
tag: 'Section',
children: ['1']
},
Expand All @@ -174,9 +174,9 @@ describe('Page builder menu actions', () => {
}
},
anotherData: {
body: {
id: 'body',
tag: 'body',
Body: {
id: 'Body',
tag: 'Body',
children: ['0']
},
0: {
Expand All @@ -203,12 +203,12 @@ describe('Page builder menu actions', () => {
expect(newState.userExpanded).toEqual({
draft: {
data: {
body: true,
Body: true,
0: true,
1: true
},
anotherData: {
body: true,
Body: true,
0: true
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ describe('Page builder selection actions', () => {
expect(newState.expanded).toEqual({
draft: {
data: {
body: true,
0: true,
1: false
}
Expand Down
56 changes: 28 additions & 28 deletions lib/shared/reducers/page-builder/page-actions/__tests__/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@ describe('PB: add element action', () => {
it('adds element to destination element with no children', () => {
const iniDoc = {
data: {
body: {
id: 'body'
Body: {
id: 'Body'
}
}
};
const expectedDoc = {
data: {
body: {
id: 'body',
Body: {
id: 'Body',
children: ['0']
},
0: {
id: '0',
parent: 'body',
parent: 'Body',
type: 'TextBox'
}
}
Expand All @@ -51,7 +51,7 @@ describe('PB: add element action', () => {

const result = action(iniDoc, {
destination: {
id: 'body',
id: 'Body',
position: 0
},
context: {
Expand All @@ -74,27 +74,27 @@ describe('PB: add element action', () => {
it('adds element with children to destination with children', () => {
const iniDoc = {
data: {
body: {
id: 'body',
Body: {
id: 'Body',
children: ['0', 'elem2']
},
0: {
parent: 'body'
parent: 'Body'
}
}
};
const expectedDoc = {
data: {
body: {
id: 'body',
Body: {
id: 'Body',
children: ['0', '1', 'elem2']
},
0: {
parent: 'body'
parent: 'Body'
},
1: {
id: '1',
parent: 'body',
parent: 'Body',
type: 'TextBox',
children: ['2', '3']
},
Expand All @@ -121,7 +121,7 @@ describe('PB: add element action', () => {

const result = action(iniDoc, {
destination: {
id: 'body',
id: 'Body',
position: 1
},
context: {
Expand Down Expand Up @@ -155,27 +155,27 @@ describe('PB: add element action', () => {
it('adds element with children to destination with children recursive', () => {
const iniDoc = {
data: {
body: {
id: 'body',
Body: {
id: 'Body',
children: ['0']
},
0: {
parent: 'body'
parent: 'Body'
}
}
};
const expectedDoc = {
data: {
body: {
id: 'body',
Body: {
id: 'Body',
children: ['0', '1']
},
0: {
parent: 'body'
parent: 'Body'
},
1: {
id: '1',
parent: 'body',
parent: 'Body',
type: 'TextBox',
children: ['2']
},
Expand Down Expand Up @@ -203,7 +203,7 @@ describe('PB: add element action', () => {

const result = action(iniDoc, {
destination: {
id: 'body',
id: 'Body',
position: 1
},
context: {
Expand Down Expand Up @@ -235,20 +235,20 @@ describe('PB: add element action', () => {
expect(result.revertAction).toEqual(expectedRevert);
});

it('adds element to not created body element', () => {
it('adds element to not created Body element', () => {
const iniDoc = {
data: {}
};
const expectedDoc = {
data: {
body: {
id: 'body',
tag: 'body',
Body: {
id: 'Body',
tag: 'Body',
children: ['0']
},
0: {
id: '0',
parent: 'body',
parent: 'Body',
type: 'TextBox'
}
}
Expand All @@ -264,7 +264,7 @@ describe('PB: add element action', () => {

const result = action(iniDoc, {
destination: {
id: 'body',
id: 'Body',
position: 0
},
context: {
Expand Down

0 comments on commit 8fee323

Please sign in to comment.