Last active
January 24, 2017 19:40
-
-
Save eneuhauser/bbf635836d7ff335975a4f02bdff8d5c to your computer and use it in GitHub Desktop.
async tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Adapter } from 'ember-pouch'; | |
import PouchDB from 'pouchdb'; | |
export default Adapter.extend({ | |
coalesceFindRequests: true, | |
init() { | |
this._super(...arguments); | |
let db = new PouchDB('test'); | |
console.log('has PouchDB', !!PouchDB); | |
/* | |
let remoteDb = new PouchDB('http://localhost:5984/test'); | |
db.sync(remoteDb, { | |
live: true, | |
retry: true | |
}); | |
this.set('remoteDb', remoteDb); | |
*/ | |
this.set('db', db); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
searchService: Ember.inject.service(), | |
actions: { | |
search(searchText) { | |
this.get('searchService').search(searchText).then(result => { | |
this.set('result', result); | |
}); | |
} | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle' | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import DS from 'ember-data'; | |
import Model from 'ember-pouch/model'; | |
export default Model.extend({ | |
text: DS.attr('string'), | |
author: DS.belongsTo('author') | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import DS from 'ember-data'; | |
import Model from 'ember-pouch/model'; | |
export default Model.extend({ | |
title: DS.attr('string'), | |
text: DS.attr('string'), | |
author: DS.belongsTo('author') | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Service.extend({ | |
search(searchText) { | |
console.log("Search called"); | |
return Ember.RSVP.resolve(`fake response for ${searchText}`); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default function destroyApp(application) { | |
Ember.run(application, 'destroy'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Resolver from '../../resolver'; | |
import config from '../../config/environment'; | |
const resolver = Resolver.create(); | |
resolver.namespace = { | |
modulePrefix: config.modulePrefix, | |
podModulePrefix: config.podModulePrefix | |
}; | |
export default resolver; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
import Application from '../../app'; | |
import config from '../../config/environment'; | |
const { run } = Ember; | |
const assign = Ember.assign || Ember.merge; | |
export default function startApp(attrs) { | |
let application; | |
let attributes = assign({rootElement: "#test-root"}, config.APP); | |
attributes = assign(attributes, attrs); // use defaults, but you can override; | |
run(() => { | |
application = Application.create(attributes); | |
application.setupForTesting(); | |
application.injectTestHelpers(); | |
}); | |
return application; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { module, test } from 'qunit'; | |
import DS from 'ember-data'; | |
//import moduleForIntegration from 'ember-pouch/tests/helpers/module-for-pouch-acceptance'; | |
import Ember from 'ember'; | |
console.log('Hello World!'); | |
module('Integration | Adapter | Basic CRUD Ops', {}, function() { | |
integration: true, | |
test('ok', function(assert) { | |
console.log('running test'); | |
assert.ok(true); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import resolver from './helpers/resolver'; | |
import { | |
setResolver | |
} from 'ember-qunit'; | |
setResolver(resolver); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.10.7", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": true | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "2.10.0", | |
"ember-data": "2.10.0", | |
"ember-template-compiler": "2.10.0", | |
"ember-testing": "2.10.0" | |
}, | |
"addons": { | |
"ember-pouch": "4.2.3" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment