Skip to content

Commit

Permalink
Merge pull request #15 from cspanring/resource-list-tests
Browse files Browse the repository at this point in the history
Fixes regression in resource list component
  • Loading branch information
davidbilling authored Sep 20, 2018
2 parents 6bf5eb5 + 7eecf33 commit 08177f9
Show file tree
Hide file tree
Showing 7 changed files with 7,302 additions and 29 deletions.
4 changes: 0 additions & 4 deletions .bowerrc

This file was deleted.

9 changes: 3 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ env:
global:
# See https://git.io/vdao3 for details.
- JOBS=1
matrix:
fast_finish: true

jobs:
fail_fast: true
allow_failures:
- env: EMBER_TRY_SCENARIO=ember-canary

Expand All @@ -42,15 +43,11 @@ matrix:
- env: EMBER_TRY_SCENARIO=ember-release
- env: EMBER_TRY_SCENARIO=ember-beta
- env: EMBER_TRY_SCENARIO=ember-canary
# - env: EMBER_TRY_SCENARIO=ember-default-with-jquery

before_install:
- npm config set spin false
- npm install -g npm@4
- npm --version

script:
- npm run lint:js
# Usually, it's ok to finish the test scenario without reverting
# to the addon's original dependency state, skipping "cleanup".
- node_modules/.bin/ember try:one $EMBER_TRY_SCENARIO
2 changes: 1 addition & 1 deletion addon/components/cloudinary-resource-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const CloudinaryResourceList = Component.extend({
})

set(this, 'items', response.resources);
return response;
return response.resources;
}
});

Expand Down
4 changes: 0 additions & 4 deletions bower.json

This file was deleted.

9 changes: 1 addition & 8 deletions config/ember-try.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,8 @@ module.exports = function() {
getChannelURL('canary')
]).then((urls) => {
return {
useYarn: true,
scenarios: [
{
name: 'ember-lts-2.12',
npm: {
devDependencies: {
'ember-source': '~2.12.0'
}
}
},
{
name: 'ember-lts-2.16',
npm: {
Expand Down
18 changes: 12 additions & 6 deletions tests/integration/components/cloudinary-resource-list-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { module, test, only } from 'qunit';
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render, find } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
Expand All @@ -7,6 +7,14 @@ import Pretender from 'pretender';
module('Integration | Component | cloudinary-resource-list', function (hooks) {
setupRenderingTest(hooks);

hooks.beforeEach(function() {
this.server = new Pretender();
});

hooks.afterEach(function() {
this.server.shutdown();
});

test('it gracefully handles fetch error', async function (assert) {
await render(hbs`
{{#cloudinary-resource-list 'test' as |resourceList|}}
Expand All @@ -18,8 +26,7 @@ module('Integration | Component | cloudinary-resource-list', function (hooks) {
});

test('it renders cloudinary response in correct order', async function (assert) {
let server = new Pretender();
server.get('https://res.cloudinary.com/cloudinary-test/image/list/test.json', () => {
this.server.get('https://res.cloudinary.com/cloudinary-test/image/list/test.json', () => {
let cloudinaryResourceListResponse = {
'resources': [{
public_id: 'my_project/image_b',
Expand Down Expand Up @@ -84,9 +91,8 @@ module('Integration | Component | cloudinary-resource-list', function (hooks) {
assert.ok(find('span:nth-child(3)').textContent.trim().endsWith('image_c'), 'Image C order is OK');
});

only('it fetches images without custom context', async function(assert) {
let server = new Pretender();
server.get('https://res.cloudinary.com/cloudinary-test/image/list/test.json', () => {
test('it fetches images without custom context', async function(assert) {
this.server.get('https://res.cloudinary.com/cloudinary-test/image/list/test.json', () => {
let cloudinaryResourceListResponse = {
resources: [
{
Expand Down
Loading

0 comments on commit 08177f9

Please sign in to comment.