From 42b75fab6a52ad6446ca1e64ed1ef94748456846 Mon Sep 17 00:00:00 2001 From: Lisa P Date: Fri, 2 Oct 2015 14:36:28 +0200 Subject: [PATCH] add a unit test for branch-row --- tests/unit/components/branch-row.coffee | 51 +++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 tests/unit/components/branch-row.coffee diff --git a/tests/unit/components/branch-row.coffee b/tests/unit/components/branch-row.coffee new file mode 100644 index 00000000..fb617ecd --- /dev/null +++ b/tests/unit/components/branch-row.coffee @@ -0,0 +1,51 @@ +`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'