Skip to content

Commit 01296cc

Browse files
authored
Merge pull request #197 from NullVoxPopuli/fix-inline-andThen
Fix inline andThen transforms
2 parents 5ceeae3 + a9a07d4 commit 01296cc

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

transforms/convert-module-for-to-setup-test/__testfixtures__/module-for-acceptance.input.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ test('it works with andThen', function() {
6060
find('#my-block');
6161
});
6262

63+
test('it works with inline andThen', function() {
64+
visit('my-route');
65+
andThen(() => assert.ok(true));
66+
andThen(() => assert.ok(false));
67+
find('#my-block');
68+
});
69+
6370
test('it works with es5 andThen', function() {
6471
visit('my-route');
6572
andThen(function() {

transforms/convert-module-for-to-setup-test/__testfixtures__/module-for-acceptance.output.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ module('Acceptance | AndThenRoute', function(hooks) {
5959
await find('#my-block');
6060
});
6161

62+
test('it works with inline andThen', async function() {
63+
await visit('my-route');
64+
assert.ok(true);
65+
assert.ok(false);
66+
await find('#my-block');
67+
});
68+
6269
test('it works with es5 andThen', async function() {
6370
await visit('my-route');
6471
assert.ok(true);

transforms/convert-module-for-to-setup-test/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,8 @@ module.exports = function(file, api) {
470470
.map(path => path.parent)
471471
.replaceWith(p => {
472472
let body = p.node.expression.arguments[0].body;
473-
return body.body;
473+
474+
return body.body || j.expressionStatement(body);
474475
});
475476

476477
if (replacements.length > 0) {

0 commit comments

Comments
 (0)