import { currentURL, visit } from '@ember/test-helpers';
import { module, test } from 'qunit';
import { setupApplicationTest } from 'ember-qunit';

module('Acceptance | convert legacy url to current', function (hooks) {
  setupApplicationTest(hooks);

  test('should convert url for legacy Ember class', async function (assert) {
    await visit('/classes/Ember.Application.html');
    assert.equal(currentURL(), '/ember/release/classes/Application');
  });

  test('should convert url for legacy Ember class to function', async function (assert) {
    await visit('/classes/Ember.computed.html');
    assert.equal(
      currentURL(),
      '/ember/release/functions/@ember%2Fobject/computed'
    );
  });

  test('should convert url for legacy ember data class', async function (assert) {
    await visit('/data/classes/DS.Adapter.html');
    assert.equal(currentURL(), '/ember-data/release/classes/Adapter');
  });

  test('should convert url for legacy ember module', async function (assert) {
    await visit('/modules/ember-application.html');
    assert.equal(currentURL(), '/ember/release/modules/@ember%2Fapplication');
  });

  test('should convert url for legacy ember data module to index', async function (assert) {
    await visit('/data/modules/ember-data.html');
    assert.equal(currentURL(), '/ember-data/release');
  });

  test('should convert unknown legacy modules url to landing page', async function (assert) {
    await visit('/modules/ember-metal'); //no .html
    assert.equal(currentURL(), '/ember/release');
  });

  test('should convert unknown legacy data url to 404', async function (assert) {
    await visit('/data/modules/ember-random.html');
    assert.equal(currentURL(), '/404');
  });

  test('should convert unknown legacy classes url to landing page', async function (assert) {
    await visit('classes/Ember.View.html');
    assert.equal(currentURL(), '/ember/release');
  });

  test('should convert unknown legacy data classes to 404', async function (assert) {
    await visit('data/classes/DS.Whatever.html');
    assert.equal(currentURL(), '/404');
  });
});

@@ -1192,13 +1192,16 @@
  to 
-index
+overview
 ', a
@@ -1284,32 +1284,39 @@
    assert.equal(
+%0A      
 currentURL(), '/
@@ -1304,32 +1304,38 @@
    currentURL(),
+%0A     
  '/ember-data/re
@@ -1331,33 +1331,66 @@
 ber-data/release
-'
+/modules/ember-data-overview'%0A    
 );%0A  %7D);%0A%0A  test

Update data tests to handle redirect to overview