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 #1347 from code-corps/add-models
Add models for github installations
- Loading branch information
Showing
14 changed files
with
193 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import Model from 'ember-data/model'; | ||
import attr from 'ember-data/attr'; | ||
import { belongsTo, hasMany } from 'ember-data/relationships'; | ||
|
||
export default Model.extend({ | ||
githubId: attr(), | ||
insertedAt: attr(), | ||
installed: attr(), | ||
state: attr(), | ||
updatedAt: attr(), | ||
|
||
githubRepos: hasMany('github-repo', { async: true }), | ||
organizationGithubAppInstallations: hasMany('organization-github-app-installation', { async: true }), | ||
project: belongsTo('project', { async: true }), | ||
user: belongsTo('user', { async: 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import Model from 'ember-data/model'; | ||
import attr from 'ember-data/attr'; | ||
import { belongsTo } from 'ember-data/relationships'; | ||
|
||
export default Model.extend({ | ||
githubAccountAvatarUrl: attr(), | ||
githubAccountId: attr(), | ||
githubAccountLogin: attr(), | ||
githubAccountType: attr(), | ||
githubId: attr(), | ||
insertedAt: attr(), | ||
name: attr(), | ||
updatedAt: attr(), | ||
|
||
githubAppInstallation: belongsTo('github-app-installation', { async: 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import Model from 'ember-data/model'; | ||
import attr from 'ember-data/attr'; | ||
import { belongsTo } from 'ember-data/relationships'; | ||
|
||
export default Model.extend({ | ||
insertedAt: attr(), | ||
updatedAt: attr(), | ||
|
||
githubAppInstallation: belongsTo('github-app-installation', { async: true }), | ||
organization: belongsTo('organization', { async: 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import Model from 'ember-data/model'; | ||
import attr from 'ember-data/attr'; | ||
import { belongsTo } from 'ember-data/relationships'; | ||
|
||
export default Model.extend({ | ||
insertedAt: attr(), | ||
updatedAt: attr(), | ||
|
||
githubRepo: belongsTo('github-repo', { async: true }), | ||
project: belongsTo('project', { async: 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
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,8 @@ | ||
import { Model, belongsTo, hasMany } from 'ember-cli-mirage'; | ||
|
||
export default Model.extend({ | ||
githubRepos: hasMany(), | ||
organizationGithubAppInstallations: hasMany(), | ||
project: belongsTo(), | ||
user: belongsTo() | ||
}); |
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,5 @@ | ||
import { Model, belongsTo } from 'ember-cli-mirage'; | ||
|
||
export default Model.extend({ | ||
githubAppInstallation: belongsTo() | ||
}); |
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,6 @@ | ||
import { Model, belongsTo } from 'ember-cli-mirage'; | ||
|
||
export default Model.extend({ | ||
githubAppInstallation: belongsTo(), | ||
organization: belongsTo() | ||
}); |
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,6 @@ | ||
import { Model, belongsTo } from 'ember-cli-mirage'; | ||
|
||
export default Model.extend({ | ||
githubRepo: belongsTo(), | ||
project: belongsTo() | ||
}); |
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,32 @@ | ||
import { moduleForModel, test } from 'ember-qunit'; | ||
import { testForBelongsTo, testForHasMany } from '../../helpers/relationship'; | ||
import { testForAttributes } from 'code-corps-ember/tests/helpers/attributes'; | ||
import '../../helpers/has-attributes'; | ||
|
||
moduleForModel('github-app-installation', 'Unit | Model | github-app-installation', { | ||
// Specify the other units that are required for this test. | ||
needs: [ | ||
'model:github-repo', | ||
'model:organization-github-app-installation', | ||
'model:project', | ||
'model:user' | ||
] | ||
}); | ||
|
||
test('it exists', function(assert) { | ||
let model = this.subject(); | ||
assert.ok(!!model); | ||
}); | ||
|
||
testForAttributes('github-app-installation', [ | ||
'githubId', | ||
'insertedAt', | ||
'installed', | ||
'state', | ||
'updatedAt' | ||
]); | ||
|
||
testForHasMany('github-app-installation', 'organizationGithubAppInstallations'); | ||
testForBelongsTo('github-app-installation', 'project'); | ||
testForBelongsTo('github-app-installation', 'user'); | ||
testForHasMany('github-app-installation', 'githubRepos'); |
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,29 @@ | ||
import { moduleForModel, test } from 'ember-qunit'; | ||
import { testForBelongsTo } from '../../helpers/relationship'; | ||
import { testForAttributes } from 'code-corps-ember/tests/helpers/attributes'; | ||
import '../../helpers/has-attributes'; | ||
|
||
moduleForModel('github-repo', 'Unit | Model | github-repo', { | ||
// Specify the other units that are required for this test. | ||
needs: [ | ||
'model:github-app-installation' | ||
] | ||
}); | ||
|
||
test('it exists', function(assert) { | ||
let model = this.subject(); | ||
assert.ok(!!model); | ||
}); | ||
|
||
testForAttributes('github-repo', [ | ||
'githubAccountAvatarUrl', | ||
'githubAccountId', | ||
'githubAccountLogin', | ||
'githubAccountType', | ||
'githubId', | ||
'insertedAt', | ||
'name', | ||
'updatedAt' | ||
]); | ||
|
||
testForBelongsTo('github-repo', 'githubAppInstallation'); |
25 changes: 25 additions & 0 deletions
25
tests/unit/models/organization-github-app-installation-test.js
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,25 @@ | ||
import { moduleForModel, test } from 'ember-qunit'; | ||
import { testForBelongsTo } from '../../helpers/relationship'; | ||
import { testForAttributes } from 'code-corps-ember/tests/helpers/attributes'; | ||
import '../../helpers/has-attributes'; | ||
|
||
moduleForModel('organization-github-app-installation', 'Unit | Model | organization-github-app-installation', { | ||
// Specify the other units that are required for this test. | ||
needs: [ | ||
'model:github-app-installation', | ||
'model:organization' | ||
] | ||
}); | ||
|
||
test('it exists', function(assert) { | ||
let model = this.subject(); | ||
assert.ok(!!model); | ||
}); | ||
|
||
testForAttributes('organization-github-app-installation', [ | ||
'insertedAt', | ||
'updatedAt' | ||
]); | ||
|
||
testForBelongsTo('organization-github-app-installation', 'githubAppInstallation'); | ||
testForBelongsTo('organization-github-app-installation', 'organization'); |
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,25 @@ | ||
import { moduleForModel, test } from 'ember-qunit'; | ||
import { testForBelongsTo } from '../../helpers/relationship'; | ||
import { testForAttributes } from 'code-corps-ember/tests/helpers/attributes'; | ||
import '../../helpers/has-attributes'; | ||
|
||
moduleForModel('project-github-repo', 'Unit | Model | project-github-repo', { | ||
// Specify the other units that are required for this test. | ||
needs: [ | ||
'model:github-repo', | ||
'model:project' | ||
] | ||
}); | ||
|
||
test('it exists', function(assert) { | ||
let model = this.subject(); | ||
assert.ok(!!model); | ||
}); | ||
|
||
testForAttributes('project-github-repo', [ | ||
'insertedAt', | ||
'updatedAt' | ||
]); | ||
|
||
testForBelongsTo('project-github-repo', 'githubRepo'); | ||
testForBelongsTo('project-github-repo', 'project'); |
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