Skip to content

Commit

Permalink
test(client/App): mock tab ref for shallow render
Browse files Browse the repository at this point in the history
Shallow renderer does not properly use ref
which may cause problems in tests unrelated
to actually modified parts.
  • Loading branch information
barmac authored and merge-me[bot] committed Feb 22, 2019
1 parent bcd1d66 commit a219288
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions client/src/app/__tests__/AppSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2328,6 +2328,9 @@ class Cache {
destroy() { }
}

class MockTab {
triggerAction() {}
}

function createApp(options = {}, mountFn=shallow) {

Expand Down Expand Up @@ -2387,6 +2390,13 @@ function createApp(options = {}, mountFn=shallow) {

app = tree.instance();

// shallow renderer always returns null on current ref
if (mountFn === shallow) {
app.tabRef = {
current: new MockTab()
};
}

return {
tree,
app
Expand Down

0 comments on commit a219288

Please sign in to comment.