-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #365 from datacite/add_tests
Add tests
- Loading branch information
Showing
15 changed files
with
199 additions
and
14 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,5 +10,5 @@ export default DS.Model.extend({ | |
|
||
meta: DS.attr(), | ||
|
||
created: DS.attr('date'), | ||
createdAt: DS.attr('date'), | ||
}); |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,5 +11,5 @@ export default DS.Model.extend({ | |
async: true, | ||
}), | ||
|
||
created: DS.attr('date'), | ||
createdAt: DS.attr('date'), | ||
}); |
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import FactoryGuy from 'ember-data-factory-guy'; | ||
|
||
FactoryGuy.define('provider', { | ||
default: { | ||
memberType: 'direct_member', | ||
technicalContact: { }, | ||
secondaryTechnicalContact: { }, | ||
billingContact: { | ||
email: '[email protected]', | ||
givenName: 'Adrian', | ||
familyName: 'Burton', | ||
}, | ||
secondaryBillingContact: { | ||
email: '[email protected]', | ||
givenName: 'David', | ||
familyName: 'Vitkin', | ||
}, | ||
serviceContact: { | ||
email: '[email protected]', | ||
givenName: 'ARDC Services', | ||
}, | ||
secondaryServiceContact: { }, | ||
votingContact: { }, | ||
}, | ||
|
||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,12 +2,51 @@ import FactoryGuy from 'ember-data-factory-guy'; | |
|
||
FactoryGuy.define('provider', { | ||
default: { | ||
name: 'Australian Research Data Commons', | ||
displayName: 'Australian Research Data Commons', | ||
symbol: 'ANDS', | ||
website: 'https://ardc.edu.au/', | ||
systemEmail: '[email protected]', | ||
groupEmail: null, | ||
description: '', | ||
region: 'APAC', | ||
country: 'AU', | ||
logoUrl: 'https://assets.datacite.org/images/members/ands.png?1583249855', | ||
memberType: 'direct_member', | ||
organizationType: 'nationalInstitution', | ||
focusArea: 'general', | ||
nonProfitStatus: 'non-profit', | ||
isActive: true, | ||
hasPassword: true, | ||
joined: '2010-02-05', | ||
rorId: 'https://ror.org/038sjwq14', | ||
}, | ||
|
||
ands: { | ||
id: 'ands', | ||
name: 'Australian National Data Service', | ||
systemEmail: '[email protected]', | ||
}, | ||
|
||
// organisation: { | ||
// memberType: 'direct_member', | ||
// technicalContact: { }, | ||
// secondaryTechnicalContact: { }, | ||
// billingContact: { | ||
// email: '[email protected]', | ||
// givenName: 'Adrian', | ||
// familyName: 'Burton', | ||
// }, | ||
// secondaryBillingContact: { | ||
// email: '[email protected]', | ||
// givenName: 'David', | ||
// familyName: 'Vitkin', | ||
// }, | ||
// serviceContact: { | ||
// email: '[email protected]', | ||
// givenName: 'ARDC Services', | ||
// }, | ||
// secondaryServiceContact: { }, | ||
// votingContact: { }, | ||
// }, | ||
}); |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,29 @@ | ||
import { module, test } from 'qunit'; | ||
import { setupTest } from 'ember-qunit'; | ||
// import { setupFactoryGuy, make } from 'ember-data-factory-guy'; | ||
|
||
module('Unit | Controller | dois', function(hooks) { | ||
setupTest(hooks); | ||
// setupFactoryGuy(hooks); | ||
|
||
// Replace this with your real tests. | ||
test('it exists', function(assert) { | ||
let controller = this.owner.lookup('controller:dois'); | ||
assert.ok(controller); | ||
}); | ||
|
||
// promise error needs to be fixed | ||
/* | ||
test('should edit doi', function(assert) { | ||
let controller = this.owner.lookup('controller:dois.show.edit'); | ||
let doi = make('doi'); | ||
let store = this.owner.lookup('service:store'); | ||
let originalSource = store.peekRecord('doi', 1).get('source'); | ||
assert.equal(originalSource,'fabrica'); | ||
controller.send('submit', doi); | ||
let targetSource = store.peekRecord('doi', 1).get('source'); | ||
assert.equal(targetSource,'fabricaForm'); | ||
}); | ||
*/ | ||
|
||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,112 @@ | ||
import { module, test } from 'qunit'; | ||
import { setupTest } from 'ember-qunit'; | ||
import { setupFactoryGuy, make } from 'ember-data-factory-guy'; | ||
|
||
module('Unit | Controller | providers', function(hooks) { | ||
setupTest(hooks); | ||
setupFactoryGuy(hooks); | ||
|
||
// Replace this with your real tests. | ||
test('it exists', function(assert) { | ||
let controller = this.owner.lookup('controller:providers'); | ||
assert.ok(controller); | ||
}); | ||
|
||
test('should list countries', function(assert) { | ||
let controller = this.owner.lookup('controller:providers.show.organizations.new'); | ||
let model = { | ||
'provider': make('provider'), | ||
'organization': make('provider', { memberType: 'consortium_organization' }), | ||
}; | ||
controller.set('model', model); | ||
controller.send('selectCountry', 'Australia'); | ||
assert.equal(controller.model.organization.get('country'), 'Australia'); | ||
controller.send('searchCountry', 'Australia'); | ||
assert.equal(controller.get('countries').length,1); | ||
}); | ||
|
||
test('should list organisation type list', function(assert) { | ||
let controller = this.owner.lookup('controller:providers.show.organizations.new'); | ||
|
||
let model = { | ||
'provider': make('provider'), | ||
'organization': make('provider', { memberType: 'consortium_organization' }), | ||
}; | ||
controller.set('model', model); | ||
controller.send('selectOrganizationType', 'nationalInstitution'); | ||
assert.equal(controller.model.organization.get('organizationType'), 'nationalInstitution'); | ||
controller.send('searchOrganizationType', 'National'); | ||
assert.equal(controller.get('organizationTypes').length,1); | ||
}); | ||
|
||
test('should list member type list', function(assert) { | ||
let controller = this.owner.lookup('controller:providers.show.organizations.new'); | ||
let model = { | ||
'provider': make('provider'), | ||
'organization': make('provider', { memberType: 'consortium_organization' }), | ||
}; | ||
controller.set('model', model); | ||
controller.send('selectMemberType', 'direct_member'); | ||
assert.equal(controller.model.organization.get('memberType'), 'direct_member'); | ||
controller.send('searchMemberType', 'direct_member'); | ||
assert.equal(controller.get('memberTypes').length,1); | ||
}); | ||
|
||
test('should list focus area list', function(assert) { | ||
let controller = this.owner.lookup('controller:providers.show.organizations.new'); | ||
let model = { | ||
'provider': make('provider'), | ||
'organization': make('provider', { memberType: 'consortium_organization' }), | ||
}; | ||
controller.set('model', model); | ||
controller.send('selectFocusArea', 'general'); | ||
assert.equal(controller.model.organization.get('focusArea'), 'general'); | ||
controller.send('searchFocusArea', 'general'); | ||
assert.equal(controller.get('focusAreas').length,1); | ||
}); | ||
|
||
test('should list non profit status list', function(assert) { | ||
let controller = this.owner.lookup('controller:providers.show.organizations.new'); | ||
let model = { | ||
'provider': make('provider'), | ||
'organization': make('provider', { memberType: 'consortium_organization' }), | ||
}; | ||
controller.set('model', model); | ||
controller.send('selectFocusArea', 'general'); | ||
assert.equal(controller.model.organization.get('focusArea'), 'general'); | ||
controller.send('searchFocusArea', 'general'); | ||
assert.equal(controller.get('focusAreas').length,1); | ||
}); | ||
|
||
// I don't know how to test for consortium either | ||
// test('should list consortium', function(assert) { | ||
// let controller = this.owner.lookup('controller:providers.show.organizations.new'); | ||
// let model = { | ||
// 'provider': make('provider'), | ||
// 'organization': make('provider', { memberType: 'consortium_organization' }), | ||
// }; | ||
// controller.set('model', model); | ||
// controller.send('searchConsortium', ''); | ||
// assert.equal(controller.model.organization.get('consortia'), ''); | ||
// controller.send('selectConsortium', ''); | ||
// assert.equal(controller.get('consortium').length,1); | ||
// }); | ||
|
||
// test('should list ror id', function(assert) { | ||
// let controller = this.owner.lookup('controller:providers.show.organizations.new'); | ||
// let model = { | ||
// 'provider': make('provider'), | ||
// 'organization': make('provider', { memberType: 'consortium_organization' }), | ||
// }; | ||
// let ror = { | ||
// 'id': 'https://ror.org/038sjwq14', | ||
// 'name': 'Australian Research Data Commons', | ||
// 'displayName': 'Australian Research Data Commons', | ||
// }; | ||
// controller.set('model', model); | ||
// controller.send('searchRor', ror.name); // what should be sent here | ||
// assert.equal(controller.model.organization.get('organizations'), ''); | ||
// controller.send('selectRor', ror); | ||
// assert.equal(controller.get('organizations').length,0); // why is organisations set to 0 | ||
// }); | ||
}); |