import { expect } from 'chai';
import { beforeEach, describe, it } from 'mocha';
import { setupRenderingTest } from 'ember-mocha';
import { click, render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
describe('Integration: transition-to', function () {
setupRenderingTest();
beforeEach(function () {
this.params = [];
this.router = this.owner.lookup('service:router');
this.router.transitionTo = (...params) => this.params = params;
});
it('triggers a transition to the router', async function () {
await render(hbs`
`);
await click('#transition');
expect(this.params).to.deep.equal(['param', 1, 'two']);
});
it('handles the passed query params', async function () {
await render(hbs`
`);
await click('#transition');
expect(this.params).to.deep.equal([
'param',
{ queryParams: { one: '1', two: '2' } }
]);
});
});