Skip to content

Commit

Permalink
Merge pull request #19 from square/deanpapastrat/random-id-test
Browse files Browse the repository at this point in the history
Add Random ID tests
  • Loading branch information
deanpapastrat authored Jun 6, 2019
2 parents bfc5be5 + 4cab6ed commit dab7c7c
Show file tree
Hide file tree
Showing 18 changed files with 2,388 additions and 2,404 deletions.
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ language: node_js
node_js:
# we recommend testing addons with the same minimum supported node version as Ember CLI
# so that your addon works for all apps
- "6"
- "8"

sudo: false
dist: trusty
Expand Down Expand Up @@ -49,8 +49,7 @@ jobs:
# we recommend new addons test the current and previous LTS
# as well as latest stable release (bonus points to beta/canary)
- stage: "Additional Tests"
env: EMBER_TRY_SCENARIO=ember-lts-2.18
- env: EMBER_TRY_SCENARIO=ember-lts-3.4
env: EMBER_TRY_SCENARIO=ember-lts-3.4
- env: EMBER_TRY_SCENARIO=ember-release
- env: EMBER_TRY_SCENARIO=ember-beta
- env: EMBER_TRY_SCENARIO=ember-canary
Expand Down
12 changes: 0 additions & 12 deletions config/ember-try.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,6 @@ module.exports = function() {
return {
useYarn: true,
scenarios: [
{
name: 'ember-lts-2.18',
env: {
EMBER_OPTIONAL_FEATURES: JSON.stringify({ 'jquery-integration': true })
},
npm: {
devDependencies: {
'@ember/jquery': '^0.5.1',
'ember-source': '~2.18.0'
}
}
},
{
name: 'ember-lts-3.4',
npm: {
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const join = require('path').join;

module.exports = {
name: require('./package').name,
contentFor(type, config) {
contentFor(type) {
if (type === 'head') {
return '<script type="text/javascript" src="https://js.squareup.com/v2/paymentform"></script>';
}
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
"lint:js": "eslint .",
"start": "ember serve",
"test": "ember test",
"test:all": "ember try:each",
"prepublishOnly": "ember ts:precompile",
"postpublish": "ember ts:clean"
"test:all": "ember try:each"
},
"dependencies": {
"broccoli-funnel": "^2.0.0",
"broccoli-merge-trees": "^3.0.0",
"ember-cli-babel": "^7.0.0",
"ember-cli-htmlbars": "^3.0.0"
},
Expand Down
Empty file removed tests/integration/.gitkeep
Empty file.
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
import { module, test } from 'qunit';
import { module, skip } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
import { trim } from 'dummy/tests/helpers/test-helpers';

module('Integration | Component | square-payment-form-apple-pay', function(hooks) {
setupRenderingTest(hooks);

test('it renders', async function(assert) {
skip('it renders', async function(assert) {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.set('myAction', function(val) { ... });

await render(hbs`{{square-payment-form-apple-pay}}`);

assert.equal(trim(this.element.textContent), '');
assert.equal(this.element.textContent, '');

// Template block usage:
await render(hbs`
Expand All @@ -22,6 +21,6 @@ module('Integration | Component | square-payment-form-apple-pay', function(hooks
{{/square-payment-form-apple-pay}}
`);

assert.equal(trim(this.element.textContent), 'template block text');
assert.equal(this.element.textContent, 'template block text');
});
});
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { module, test } from 'qunit';
import { module, skip } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';

module('Integration | Component | square-payment-form-cc-input', function(hooks) {
setupRenderingTest(hooks);

test('it renders', async function(assert) {
skip('it renders', async function(assert) {
this.set('formId', 'abc');

await render(hbs`{{square-payment-form-cc-input formId=formId}}`);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
import { module, test } from 'qunit';
import { module, skip } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
import { trim } from 'dummy/tests/helpers/test-helpers';

module('Integration | Component | square-payment-form-credit-card-fields', function(hooks) {
setupRenderingTest(hooks);

test('it renders', async function(assert) {
skip('it renders', async function(assert) {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.set('myAction', function(val) { ... });

await render(hbs`{{square-payment-form-credit-card-fields}}`);

assert.equal(trim(this.element.textContent), '');
assert.equal(this.element.textContent, '');

// Template block usage:
await render(hbs`
Expand All @@ -22,6 +21,6 @@ module('Integration | Component | square-payment-form-credit-card-fields', funct
{{/square-payment-form-credit-card-fields}}
`);

assert.equal(trim(this.element.textContent), 'template block text');
assert.equal(this.element.textContent, 'template block text');
});
});
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { module, test } from 'qunit';
import { module, skip } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';

module('Integration | Component | square-payment-form-cvv-input', function(hooks) {
setupRenderingTest(hooks);

test('it renders', async function(assert) {
skip('it renders', async function(assert) {
this.set('formId', 'abc');

await render(hbs`{{square-payment-form-cvv-input formId=formId}}`);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { module, test } from 'qunit';
import { module, skip } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';

module('Integration | Component | square-payment-form-expiration-input', function(hooks) {
setupRenderingTest(hooks);

test('it renders', async function(assert) {
skip('it renders', async function(assert) {
this.set('formId', 'abc');

await render(hbs`{{square-payment-form-expiration-input formId=formId}}`);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
import { module, test } from 'qunit';
import { module, skip } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
import { trim } from 'dummy/tests/helpers/test-helpers';

module('Integration | Component | square-payment-form-google-pay', function(hooks) {
setupRenderingTest(hooks);

test('it renders', async function(assert) {
skip('it renders', async function(assert) {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.set('myAction', function(val) { ... });

await render(hbs`{{square-payment-form-google-pay}}`);

assert.equal(trim(this.element.textContent), '');
assert.equal(this.element.textContent, '');

// Template block usage:
await render(hbs`
Expand All @@ -22,6 +21,6 @@ module('Integration | Component | square-payment-form-google-pay', function(hook
{{/square-payment-form-google-pay}}
`);

assert.equal(trim(this.element.textContent), 'template block text');
assert.equal(this.element.textContent, 'template block text');
});
});
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
import { module, test } from 'qunit';
import { module, skip } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
import { trim } from 'dummy/tests/helpers/test-helpers';

module('Integration | Component | square-payment-form-masterpass', function(hooks) {
setupRenderingTest(hooks);

test('it renders', async function(assert) {
skip('it renders', async function(assert) {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.set('myAction', function(val) { ... });

await render(hbs`{{square-payment-form-masterpass}}`);

assert.equal(trim(this.element.textContent), '');
assert.equal(this.element.textContent, '');

// Template block usage:
await render(hbs`
Expand All @@ -22,6 +21,6 @@ module('Integration | Component | square-payment-form-masterpass', function(hook
{{/square-payment-form-masterpass}}
`);

assert.equal(trim(this.element.textContent), 'template block text');
assert.equal(this.element.textContent, 'template block text');
});
});
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { module, test } from 'qunit';
import { module, skip } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';

module('Integration | Component | square-payment-form-postal-input', function(hooks) {
setupRenderingTest(hooks);

test('it renders', async function(assert) {
skip('it renders', async function(assert) {
this.set('formId', 'abc');

await render(hbs`{{square-payment-form-postal-input formId=formId}}`);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import { module, test } from 'qunit';
import { module, skip } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
import { trim } from 'dummy/tests/helpers/test-helpers';

module('Integration | Component | square-payment-form-styled', function(hooks) {
setupRenderingTest(hooks);

test('it renders', async function(assert) {
skip('it renders', async function(assert) {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.set('myAction', function(val) { ... });

await render(hbs`{{square-payment-form-styled}}`);

assert.equal(trim(this.element.textContent), '');
assert.equal(this.element.textContent, '');
});
});
9 changes: 4 additions & 5 deletions tests/integration/components/square-payment-form-test.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
import { module, test } from 'qunit';
import { module, skip } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
import { trim } from 'dummy/tests/helpers/test-helpers';

module('Integration | Component | square-payment-form', function(hooks) {
setupRenderingTest(hooks);

test('it renders', async function(assert) {
skip('it renders', async function(assert) {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.set('myAction', function(val) { ... });

await render(hbs`{{square-payment-form}}`);

assert.equal(trim(this.element.textContent), '');
assert.equal(this.element.textContent, '');

// Template block usage:
await render(hbs`
Expand All @@ -22,6 +21,6 @@ module('Integration | Component | square-payment-form', function(hooks) {
{{/square-payment-form}}
`);

assert.equal(trim(this.element.textContent), 'template block text');
assert.equal(this.element.textContent, 'template block text');
});
});
15 changes: 15 additions & 0 deletions tests/unit/utils/random-id-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import randomId from 'dummy/utils/random-id';
import { module, test } from 'qunit';

module('Unit | Utility | random-ids', function() {
test('it generates an id', function(assert) {
const result = randomId();
assert.ok(result, 'id exists');
});

test('does not generate the same id when called repeatedly', function(assert) {
const results = Array.from(Array(10), randomId);
const resultSet = new Set(results);
assert.equal(resultSet.size, results.length, 'no duplicates exist');
});
});
12 changes: 0 additions & 12 deletions tests/unit/utils/random-id-test.ts

This file was deleted.

Loading

0 comments on commit dab7c7c

Please sign in to comment.