Skip to content

Commit

Permalink
chore(orga): remove component unit tests for Campaign::Activity::Dash…
Browse files Browse the repository at this point in the history
…board
  • Loading branch information
frinyvonnick committed Sep 24, 2024
1 parent fc7c0a2 commit 4759bce
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 62 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { render } from '@1024pix/ember-testing-library';
import { hbs } from 'ember-cli-htmlbars';
import { module, test } from 'qunit';
import sinon from 'sinon';

import setupIntlRenderingTest from '../../../../helpers/setup-intl-rendering';

module('Integration | Component | Campaign::Activity::Dashboard', (hooks) => {
setupIntlRenderingTest(hooks);

hooks.beforeEach(function () {
const store = this.owner.lookup('service:store');
const adapterStub = {
getParticipationsByStatus: sinon
.stub()
.withArgs('1')
.resolves({
data: {
attributes: {
started: 1,
completed: 2,
shared: 3,
},
},
}),
getParticipationsByDay: sinon.stub().resolves({
data: {
attributes: {
'started-participations': [],
'shared-participations': [],
},
},
}),
};
sinon.stub(store, 'adapterFor');
store.adapterFor.withArgs('campaign-stats').returns(adapterStub);
});

test('it displays right data', async function (assert) {
this.set('campaign', { id: '1' });

const screen = await render(hbs`<Campaign::Activity::Dashboard @campaign={{this.campaign}} />`);

assert.ok(screen.getByText('6'));
});
});
43 changes: 0 additions & 43 deletions orga/tests/unit/components/campaign/activity/dashboard-test.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,6 @@ module('Unit | Component | Campaign::Charts::ParticipantsByDay', (hooks) => {
dataFetcher = sinon.stub(adapter, 'getParticipationsByDay');
});

test('should pass without data', async function (assert) {
// given
dataFetcher.resolves({
data: {
attributes: {
'started-participations': [],
'shared-participations': [],
},
},
});

// when
component = await createGlimmerComponent('component:campaign/charts/participants-by-day');

// then
assert.deepEqual(component.startedDatasets, []);
assert.deepEqual(component.sharedDatasets, []);
});

test('should fill the default datasets', async function (assert) {
// given
dataFetcher.resolves({
Expand Down

0 comments on commit 4759bce

Please sign in to comment.