github.com/sl1pm4t/consul@v1.4.5-0.20190325224627-74c31c540f9c/ui-v2/tests/unit/utils/routing/walk-test.js (about)

     1  import { walk } from 'consul-ui/utils/routing/walk';
     2  import { module } from 'qunit';
     3  import test from 'ember-sinon-qunit/test-support/test';
     4  
     5  module('Unit | Utility | routing/walk');
     6  
     7  test('it walks down deep routes', function(assert) {
     8    const route = this.stub();
     9    const Router = {
    10      route: function(name, options, cb) {
    11        route();
    12        if (cb) {
    13          cb.apply(this, []);
    14        }
    15      },
    16    };
    17    walk.apply(Router, [
    18      {
    19        route: {
    20          _options: {
    21            path: '/:path',
    22          },
    23          next: {
    24            _options: {
    25              path: '/:path',
    26            },
    27            inside: {
    28              _options: {
    29                path: '/*path',
    30              },
    31            },
    32          },
    33        },
    34      },
    35    ]);
    36    assert.equal(route.callCount, 3);
    37  });