Super Rental Acceptance Test Not Working

I’m new to Ember and working through the Super Rentals tutorial. Loving it so far! I reached the first acceptance testing section and successfully created the super-rentals-test.js file. However, when I replace the code with the example in the tutorial, I get errors.

Line 3: Parsing error: identifier ‘visit’ has already been declared. (3:16) eslint Line 24: ‘}’ expected. ts(1005)

If I try to remove the duplicate ‘visit’ import, then currentURL shows the same error. If I remove the duplicate ‘currentURL’, then I get this error later in the code:

Line 10: Using QUnit.test inside of another QUnit.test is not allowed. eslint(quint/no-nested-tests)

…which wasn’t an issue until I removed the duplicate imports.

Adding }); at the end resolved the Line 24 error since the module wasn’t closed.

This is the provided code, copy and pasted:

import { module, test } from ‘qunit’; import { visit, currentURL } from ‘@ember/test-helpers’; import { click, visit, currentURL } from ‘@ember/test-helpers’; import { setupApplicationTest } from ‘super-rentals/tests/helpers’;

module(‘Acceptance | super rentals’, function (hooks) { setupApplicationTest(hooks);

test(‘visiting /super-rentals’, async function (assert) { await visit(‘/super-rentals’); test(‘visiting /’, async function (assert) { await visit(‘/’);

assert.strictEqual(currentURL(), '/super-rentals');
assert.strictEqual(currentURL(), '/');
assert.dom('h2').hasText('Welcome to Super Rentals!');

assert.dom('.jumbo a.button').hasText('About Us');
await click('.jumbo a.button');

assert.strictEqual(currentURL(), '/about');

}); });

Any help would be greatly appreciated. I tried searching for a similar topic but couldn’t find one (or didn’t know how to word the search well enough to find one.)

When I move to the next step and completely replace the code with the new example, it works now. Looks like the duplicated imports of ‘visit’ and ‘currentURL’ were removed and the test of ‘visiting /super-rentals’ (and any reference to that page) was removed. Could this have been left-over from a previous version of the tutorial? I don’t believe the creation of the /super-rentals page is a step in the current iteration, so that may have been the culprit after removing the duplicate imports. When I go back a step and make those changes, the test runs successfully.

Am I on the right track of what could have been causing the issue? Or did I do something incorrectly and now I could be missing an important step?

first of all, welcome!!! :tada: second, thanks for reporting an issue! issue reporting is super helpful as sometimes small details go unnoticed.

which pages of the tutorial were you looking at? can you link them? the code you provided (around duplicate imports), is def invalid, and the errors are correct.

the behavior where you seeing one error after another was being reported is kinda just how javascript works, but it does look like from the code you provided you were missing a }) for your first test, so the second test was parsed by javascript is being in the first test – which qunit doesn’t know how to handle.

I’m happy you were able to move forward though!!

Or did I do something incorrectly and now I could be missing an important step?

I’m not sure if you did anything wrong, but it’s’ possible copy-paste could have got in your way, like if you copied a diff snippet that simultaneously included the removal and addition of similar lines, for example.