Skip to content

Commit

Permalink
Improve integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lindyhopchris committed Aug 10, 2019
1 parent eb5d4d2 commit b0bbcd3
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 23 deletions.
2 changes: 1 addition & 1 deletion tests/dummy/config/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ module.exports = function(environment) {
}

if (environment === 'production') {

// production config
}

return ENV;
Expand Down
9 changes: 5 additions & 4 deletions tests/integration/components/stripe-card-cvc-test.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
import { render } from '@ember/test-helpers';
import { render, find } from '@ember/test-helpers';
import StripeMock from 'ember-stripe-elements/utils/stripe-mock';
import env from 'dummy/config/environment';
import StripeService from 'dummy/services/stripev3';

module('Integration | Component | stripe card cvc', function(hooks) {
module('Integration | Component | stripe-card-cvc', function(hooks) {
setupRenderingTest(hooks);

hooks.beforeEach(function() {
Expand All @@ -23,9 +23,10 @@ module('Integration | Component | stripe card cvc', function(hooks) {
);
});

test('it renders', async function(assert) {
test('it renders', async function (assert) {
await render(hbs`{{stripe-card-cvc}}`);

assert.equal(this.element.textContent.trim(), '');
assert.ok(find('.ember-stripe-element.ember-stripe-card-cvc'));
assert.ok(find('[role="mount-point"]'));
});
});
7 changes: 4 additions & 3 deletions tests/integration/components/stripe-card-expiry-test.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
import { render } from '@ember/test-helpers';
import { render, find } from '@ember/test-helpers';
import StripeMock from 'ember-stripe-elements/utils/stripe-mock';
import env from 'dummy/config/environment';
import StripeService from 'dummy/services/stripev3';

module('Integration | Component | stripe card expiry', function(hooks) {
module('Integration | Component | stripe-card-expiry', function(hooks) {
setupRenderingTest(hooks);

hooks.beforeEach(function() {
Expand All @@ -26,6 +26,7 @@ module('Integration | Component | stripe card expiry', function(hooks) {
test('it renders', async function(assert) {
await render(hbs`{{stripe-card-expiry}}`);

assert.equal(this.element.textContent.trim(), '');
assert.ok(find('.ember-stripe-element.ember-stripe-card-expiry'));
assert.ok(find('[role="mount-point"]'));
});
});
6 changes: 3 additions & 3 deletions tests/integration/components/stripe-card-number-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
import { render } from '@ember/test-helpers';
import { render, find } from '@ember/test-helpers';
import StripeMock from 'ember-stripe-elements/utils/stripe-mock';
import env from 'dummy/config/environment';
import StripeService from 'dummy/services/stripev3';
Expand All @@ -26,7 +26,7 @@ module('Integration | Component | stripe card number', function(hooks) {
test('it renders', async function(assert) {
await render(hbs`{{stripe-card-number}}`);

assert.equal(this.element.textContent.trim(), '');
assert.ok(find('.ember-stripe-element.ember-stripe-card-number'));
assert.ok(find('[role="mount-point"]'));
});
});

14 changes: 5 additions & 9 deletions tests/integration/components/stripe-card-test.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
import { render } from '@ember/test-helpers';
import { render, find } from '@ember/test-helpers';
import StripeMock from 'ember-stripe-elements/utils/stripe-mock';
import env from 'dummy/config/environment';
import StripeService from 'dummy/services/stripev3';

module('Integration | Component | stripe card', function(hooks) {
module('Integration | Component | stripe-card', function(hooks) {
setupRenderingTest(hooks);

hooks.beforeEach(function() {
Expand All @@ -24,14 +24,10 @@ module('Integration | Component | stripe card', function(hooks) {
});

test('it renders', async function(assert) {
// Template block usage:
await render(hbs`
{{#stripe-card}}
template block text
{{/stripe-card}}
`);
await render(hbs`{{stripe-card}}`);

assert.equal(this.element.textContent.trim(), 'template block text');
assert.ok(find('.ember-stripe-element.ember-stripe-card'));
assert.ok(find('[role="mount-point"]'));
});

test('yields out error message', async function(assert) {
Expand Down
7 changes: 4 additions & 3 deletions tests/integration/components/stripe-postal-code-test.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
import { render } from '@ember/test-helpers';
import { render, find } from '@ember/test-helpers';
import StripeMock from 'ember-stripe-elements/utils/stripe-mock';
import env from 'dummy/config/environment';
import StripeService from 'dummy/services/stripev3';

module('Integration | Component | stripe postal code', function(hooks) {
module('Integration | Component | stripe-postal-code', function(hooks) {
setupRenderingTest(hooks);

hooks.beforeEach(function() {
Expand All @@ -26,6 +26,7 @@ module('Integration | Component | stripe postal code', function(hooks) {
test('it renders', async function(assert) {
await render(hbs`{{stripe-postal-code}}`);

assert.equal(this.element.textContent.trim(), '');
assert.ok(find('.ember-stripe-element.ember-stripe-postal-code'));
assert.ok(find('[role="mount-point"]'));
});
});

0 comments on commit b0bbcd3

Please sign in to comment.