Skip to content

Commit

Permalink
Add to unit tests to ensure test accepts both edits of enter and leave
Browse files Browse the repository at this point in the history
  • Loading branch information
leebyron committed Feb 23, 2016
1 parent f79ba42 commit d2c005a
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions src/language/__tests__/visitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,29 @@ describe('Visitor', () => {
kind: 'SelectionSet',
selections: []
},
didEnter: true,
};
},
leave(node) {
return {
...node,
selectionSet,
didLeave: true,
};
}
}
});

expect(editedAst).to.deep.equal(ast);
expect(editedAst).to.deep.equal({
...ast,
definitions: [
{
...ast.definitions[0],
didEnter: true,
didLeave: true
}
]
});
});

it('allows editing the root node on enter and on leave', () => {
Expand All @@ -62,19 +73,25 @@ describe('Visitor', () => {
enter(node) {
return {
...node,
definitions: []
definitions: [],
didEnter: true,
};
},
leave(node) {
return {
...node,
definitions,
didLeave: true,
};
}
}
});

expect(editedAst).to.deep.equal(ast);
expect(editedAst).to.deep.equal({
...ast,
didEnter: true,
didLeave: true
});
});

it('allows for editing on enter', () => {
Expand Down

0 comments on commit d2c005a

Please sign in to comment.