fix branch-row-unit test
This commit is contained in:
parent
3827b6b4d8
commit
129674aa25
57
tests/unit/components/branch-row-test.coffee
Normal file
57
tests/unit/components/branch-row-test.coffee
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
`import { test, moduleForComponent } from 'ember-qunit'`
|
||||||
|
|
||||||
|
moduleForComponent 'branch-row', 'BranchRowComponent', {
|
||||||
|
# specify the other units that are required for this test
|
||||||
|
needs: ['helper:format-time', 'helper:format-duration', 'helper:pretty-date', 'helper:format-sha',
|
||||||
|
'component:build-tile', 'component:status-icon', 'component:request-icon', 'component:loading-indicator']
|
||||||
|
}
|
||||||
|
|
||||||
|
test 'it renders', ->
|
||||||
|
|
||||||
|
attributes = {
|
||||||
|
name: "master"
|
||||||
|
repository: {
|
||||||
|
id: 15038
|
||||||
|
name: "php-test-staging"
|
||||||
|
slug: "travis-repos/php-test-staging"
|
||||||
|
}
|
||||||
|
default_branch: true
|
||||||
|
exists_on_github: true
|
||||||
|
last_build: {
|
||||||
|
id: 393177
|
||||||
|
number: "1"
|
||||||
|
state: "passed"
|
||||||
|
duration: 22
|
||||||
|
event_type: "push"
|
||||||
|
previous_state: null
|
||||||
|
started_at: "2015-03-10T23:19:31Z"
|
||||||
|
finished_at: "2015-03-10T23:19:45Z"
|
||||||
|
commit: {
|
||||||
|
id: 160181
|
||||||
|
sha: "a82f6ba76c7b729375ed6a1d7a26b765f694df12"
|
||||||
|
ref: "refs/heads/master"
|
||||||
|
message: "Add money example as hello world"
|
||||||
|
compare_url: "https://github.com/travis-repos/php-test-staging/compare/3d86ee98be2b...a82f6ba76c7b"
|
||||||
|
committed_at: "2014-11-20T18:34:04Z"
|
||||||
|
committer: {
|
||||||
|
name: "Dan Buch"
|
||||||
|
avatar_url: "https://0.gravatar.com/avatar/563fd372b4d51781853bc85147f06a36"
|
||||||
|
}
|
||||||
|
author: {
|
||||||
|
name: "Dan Buch"
|
||||||
|
avatar_url: "https://0.gravatar.com/avatar/563fd372b4d51781853bc85147f06a36"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
component = @subject(build: attributes)
|
||||||
|
|
||||||
|
@append()
|
||||||
|
|
||||||
|
ok component.$().hasClass('passed'), 'component should have state class (passed)'
|
||||||
|
equal component.$('.row-name .label-align').text().trim(), 'master', 'should display correct branch name'
|
||||||
|
equal component.$('.row-request .label-align').text().trim(), '#1 passed', 'should display build number and state'
|
||||||
|
equal component.$('.row-commiter .label-align').text().trim(), 'Dan Buch', 'should display correct commiter name'
|
||||||
|
equal component.$('.row-commit .label-align').text().trim(), 'a82f6ba', 'should display correct commit sha'
|
|
@ -1,51 +0,0 @@
|
||||||
`import { test, moduleForComponent } from 'ember-qunit'`
|
|
||||||
|
|
||||||
moduleForComponent 'branch-row', 'BranchRowComponent', {
|
|
||||||
# specify the other units that are required for this test
|
|
||||||
needs: ['helper:format-time', 'helper:format-duration', 'helper:format-sha', 'component:status-icon', 'component:request-icon']
|
|
||||||
}
|
|
||||||
|
|
||||||
test 'it renders', ->
|
|
||||||
|
|
||||||
attributes = {
|
|
||||||
name: "local-test",
|
|
||||||
repository: {
|
|
||||||
id: 13661,
|
|
||||||
slug: "meatballhat/yolo-octo-adventure",
|
|
||||||
default_branch: {
|
|
||||||
name: "master",
|
|
||||||
last_build: {
|
|
||||||
id: 434835,
|
|
||||||
number: "1086",
|
|
||||||
state: "passed",
|
|
||||||
duration: 11,
|
|
||||||
event_type: "push",
|
|
||||||
previous_state: "passed",
|
|
||||||
started_at: "2015-08-24T21:34:22Z",
|
|
||||||
finished_at: "2015-08-24T21:35:14Z",
|
|
||||||
commit: {
|
|
||||||
sha: "0e9d8ebc78d2192cc599580751763a5dd6be0ccd",
|
|
||||||
committer: {
|
|
||||||
name: "Dan Buch",
|
|
||||||
avatar_url: "https://0.gravatar.com/avatar/563fd372b4d51781853bc85147f06a36"
|
|
||||||
},
|
|
||||||
author: {
|
|
||||||
name: "Dan Buch",
|
|
||||||
avatar_url: "https://0.gravatar.com/avatar/563fd372b4d51781853bc85147f06a36"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
component = @subject(repo: attributes)
|
|
||||||
|
|
||||||
@append()
|
|
||||||
|
|
||||||
ok component.$().hasClass('passed'), 'component should have state class (passed)'
|
|
||||||
equal component.$('.row-name').text().trim(), 'master', 'should display correct branch name'
|
|
||||||
equal component.$('.row-request').text().trim(), '#1086 passed', 'should display build number and state'
|
|
||||||
equal component.$('.row-commiter').text().trim(), 'Dan Buch', 'should display correct commiter name'
|
|
||||||
equal component.$('.row-commit').text().trim(), '0e9d8eb', 'should display correct commit sha'
|
|
Loading…
Reference in New Issue
Block a user