{"action":"created","comment":{"url":"https://api.github.com/repos/bem-incubator/bem-deps/pulls/comments/33266587","id":33266587,"diff_hunk":"@@ -0,0 +1,187 @@\n+var expect  = require('chai').expect,\n+    _       = require('lodash'),\n+    resolve = require('../../../lib/index').resolve;\n+\n+describe('resolve', function () {\n+    describe('unordered dependencies: entity - entity', function () {\n+        it('should resolve entity depending on another entity', function () {\n+            var decl = [{ block: 'A' }],\n+                deps = [\n+                    {\n+                        entity: { block: 'A' },\n+                        dependOn: [{ entity: { block: 'B' } }]\n+                    }\n+                ],\n+                resolved = resolve(decl, deps);\n+\n+            expect(resolved.entities).to.contain({ block: 'B' });\n+        });\n+\n+        it('should resolve entity depending on multiple entities', function () {\n+            var decl = [{ block: 'A' }],\n+                deps = [\n+                    {\n+                        entity: { block: 'A' },\n+                        dependOn: [\n+                            { entity: { block: 'B' } },\n+                            { entity: { block: 'C' } }\n+                        ]\n+                    }\n+                ],\n+                resolved = resolve(decl, deps);\n+\n+            expect(resolved.entities).to.contain({ block: 'B' })\n+                .and.to.contain({ block: 'C' });\n+        });\n+\n+        it('should include entity once if entity depends on itself', function () {\n+            var decl = [{ block: 'A' }],\n+                deps = [\n+                    {\n+                        entity: { block: 'A' },\n+                        dependOn: [\n+                            { entity: { block: 'A' } }\n+                        ]\n+                    }\n+                ],\n+                resolved = resolve(decl, deps);\n+\n+            expect(resolved.entities).to.be.eql([{ block: 'A' }]);\n+        });\n+\n+        it('should resolve dependency depending on another entity', function () {\n+            var decl = [{ block: 'A' }],\n+                deps = [\n+                    {\n+                        entity: { block: 'A' },\n+                        dependOn: [\n+                            { entity: { block: 'B' } }\n+                        ]\n+                    },\n+                    {\n+                        entity: { block: 'B' },\n+                        dependOn: [\n+                            { entity: { block: 'C' } }\n+                        ]\n+                    }\n+                ],\n+                resolved = resolve(decl, deps);\n+\n+            expect(resolved.entities).to.contain({ block: 'C' });\n+        });\n+\n+        it('should allow dependency to depend on multiple another entities', function () {\n+            var decl = [{ block: 'A' }],\n+                deps = [\n+                    {\n+                        entity: { block: 'A' },\n+                        dependOn: [\n+                            { entity: { block: 'B' } }\n+                        ]\n+                    },\n+                    {\n+                        entity: { block: 'B' },\n+                        dependOn: [\n+                            { entity: { block: 'C' } },\n+                            { entity: { block: 'D' } }\n+                        ]\n+                    }\n+                ],\n+                resolved = resolve(decl, deps);\n+\n+            expect(resolved.entities).to.contain({ block: 'C' })\n+                .and.to.contain({ block: 'D' });\n+        });\n+\n+        it('should include entity to result once if multiple entities depend on this entity', function () {\n+            var decl = [\n+                    { block: 'A' },\n+                    { block: 'B' }\n+                ],\n+                deps = [\n+                    {\n+                        entity: { block: 'A' },\n+                        dependOn: [\n+                            { entity: { block: 'C' } }\n+                        ]\n+                    },\n+                    {\n+                        entity: { block: 'B' },\n+                        dependOn: [\n+                            { entity: { block: 'C' } }\n+                        ]\n+                    }\n+                ],\n+                resolved = resolve(decl, deps),\n+                firstIndex = _.findIndex(resolved.entities, { block: 'C' }),\n+                lastIndex = _.findLastIndex(resolved.entities, { block: 'C' });\n+\n+            expect(resolved).to.contain({ block: 'C' });\n+            expect(firstIndex).to.be.equal(lastIndex);\n+        });\n+\n+        it('should include entity if this entity is indirect dependency of entity listed in decl', function () {","path":"spec/resolve/unordered_dependencies/entity-entity.spec.js","position":123,"original_position":123,"commit_id":"55baaf5c8c761fd939a48181beb412dedb865b84","original_commit_id":"55baaf5c8c761fd939a48181beb412dedb865b84","user":{"login":"blond","id":2225579,"avatar_url":"https://avatars.githubusercontent.com/u/2225579?v=3","gravatar_id":"","url":"https://api.github.com/users/blond","html_url":"https://github.com/blond","followers_url":"https://api.github.com/users/blond/followers","following_url":"https://api.github.com/users/blond/following{/other_user}","gists_url":"https://api.github.com/users/blond/gists{/gist_id}","starred_url":"https://api.github.com/users/blond/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blond/subscriptions","organizations_url":"https://api.github.com/users/blond/orgs","repos_url":"https://api.github.com/users/blond/repos","events_url":"https://api.github.com/users/blond/events{/privacy}","received_events_url":"https://api.github.com/users/blond/received_events","type":"User","site_admin":false},"body":"Чем это отличается от `should resolve dependency depending on another entity`?","created_at":"2015-06-25T15:19:02Z","updated_at":"2015-06-25T15:19:02Z","html_url":"https://github.com/bem-incubator/bem-deps/pull/11#discussion_r33266587","pull_request_url":"https://api.github.com/repos/bem-incubator/bem-deps/pulls/11","_links":{"self":{"href":"https://api.github.com/repos/bem-incubator/bem-deps/pulls/comments/33266587"},"html":{"href":"https://github.com/bem-incubator/bem-deps/pull/11#discussion_r33266587"},"pull_request":{"href":"https://api.github.com/repos/bem-incubator/bem-deps/pulls/11"}}},"pull_request":{"url":"https://api.github.com/repos/bem-incubator/bem-deps/pulls/11","id":38321987,"html_url":"https://github.com/bem-incubator/bem-deps/pull/11","diff_url":"https://github.com/bem-incubator/bem-deps/pull/11.diff","patch_url":"https://github.com/bem-incubator/bem-deps/pull/11.patch","issue_url":"https://api.github.com/repos/bem-incubator/bem-deps/issues/11","number":11,"state":"open","locked":false,"title":"Specs about resolving unordered entity - entity dependencies","user":{"login":"SwinX","id":854899,"avatar_url":"https://avatars.githubusercontent.com/u/854899?v=3","gravatar_id":"","url":"https://api.github.com/users/SwinX","html_url":"https://github.com/SwinX","followers_url":"https://api.github.com/users/SwinX/followers","following_url":"https://api.github.com/users/SwinX/following{/other_user}","gists_url":"https://api.github.com/users/SwinX/gists{/gist_id}","starred_url":"https://api.github.com/users/SwinX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SwinX/subscriptions","organizations_url":"https://api.github.com/users/SwinX/orgs","repos_url":"https://api.github.com/users/SwinX/repos","events_url":"https://api.github.com/users/SwinX/events{/privacy}","received_events_url":"https://api.github.com/users/SwinX/received_events","type":"User","site_admin":false},"body":"Resolves #10 ","created_at":"2015-06-23T10:29:24Z","updated_at":"2015-06-25T15:19:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"74cc9f80115097466f8b2ebfc9c7a36d667e8715","assignee":{"login":"blond","id":2225579,"avatar_url":"https://avatars.githubusercontent.com/u/2225579?v=3","gravatar_id":"","url":"https://api.github.com/users/blond","html_url":"https://github.com/blond","followers_url":"https://api.github.com/users/blond/followers","following_url":"https://api.github.com/users/blond/following{/other_user}","gists_url":"https://api.github.com/users/blond/gists{/gist_id}","starred_url":"https://api.github.com/users/blond/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blond/subscriptions","organizations_url":"https://api.github.com/users/blond/orgs","repos_url":"https://api.github.com/users/blond/repos","events_url":"https://api.github.com/users/blond/events{/privacy}","received_events_url":"https://api.github.com/users/blond/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/bem-incubator/bem-deps/pulls/11/commits","review_comments_url":"https://api.github.com/repos/bem-incubator/bem-deps/pulls/11/comments","review_comment_url":"https://api.github.com/repos/bem-incubator/bem-deps/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bem-incubator/bem-deps/issues/11/comments","statuses_url":"https://api.github.com/repos/bem-incubator/bem-deps/statuses/55baaf5c8c761fd939a48181beb412dedb865b84","head":{"label":"bem-incubator:issue-10","ref":"issue-10","sha":"55baaf5c8c761fd939a48181beb412dedb865b84","user":{"login":"bem-incubator","id":10929504,"avatar_url":"https://avatars.githubusercontent.com/u/10929504?v=3","gravatar_id":"","url":"https://api.github.com/users/bem-incubator","html_url":"https://github.com/bem-incubator","followers_url":"https://api.github.com/users/bem-incubator/followers","following_url":"https://api.github.com/users/bem-incubator/following{/other_user}","gists_url":"https://api.github.com/users/bem-incubator/gists{/gist_id}","starred_url":"https://api.github.com/users/bem-incubator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bem-incubator/subscriptions","organizations_url":"https://api.github.com/users/bem-incubator/orgs","repos_url":"https://api.github.com/users/bem-incubator/repos","events_url":"https://api.github.com/users/bem-incubator/events{/privacy}","received_events_url":"https://api.github.com/users/bem-incubator/received_events","type":"Organization","site_admin":false},"repo":{"id":36862023,"name":"bem-deps","full_name":"bem-incubator/bem-deps","owner":{"login":"bem-incubator","id":10929504,"avatar_url":"https://avatars.githubusercontent.com/u/10929504?v=3","gravatar_id":"","url":"https://api.github.com/users/bem-incubator","html_url":"https://github.com/bem-incubator","followers_url":"https://api.github.com/users/bem-incubator/followers","following_url":"https://api.github.com/users/bem-incubator/following{/other_user}","gists_url":"https://api.github.com/users/bem-incubator/gists{/gist_id}","starred_url":"https://api.github.com/users/bem-incubator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bem-incubator/subscriptions","organizations_url":"https://api.github.com/users/bem-incubator/orgs","repos_url":"https://api.github.com/users/bem-incubator/repos","events_url":"https://api.github.com/users/bem-incubator/events{/privacy}","received_events_url":"https://api.github.com/users/bem-incubator/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bem-incubator/bem-deps","description":"","fork":false,"url":"https://api.github.com/repos/bem-incubator/bem-deps","forks_url":"https://api.github.com/repos/bem-incubator/bem-deps/forks","keys_url":"https://api.github.com/repos/bem-incubator/bem-deps/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bem-incubator/bem-deps/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bem-incubator/bem-deps/teams","hooks_url":"https://api.github.com/repos/bem-incubator/bem-deps/hooks","issue_events_url":"https://api.github.com/repos/bem-incubator/bem-deps/issues/events{/number}","events_url":"https://api.github.com/repos/bem-incubator/bem-deps/events","assignees_url":"https://api.github.com/repos/bem-incubator/bem-deps/assignees{/user}","branches_url":"https://api.github.com/repos/bem-incubator/bem-deps/branches{/branch}","tags_url":"https://api.github.com/repos/bem-incubator/bem-deps/tags","blobs_url":"https://api.github.com/repos/bem-incubator/bem-deps/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bem-incubator/bem-deps/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bem-incubator/bem-deps/git/refs{/sha}","trees_url":"https://api.github.com/repos/bem-incubator/bem-deps/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bem-incubator/bem-deps/statuses/{sha}","languages_url":"https://api.github.com/repos/bem-incubator/bem-deps/languages","stargazers_url":"https://api.github.com/repos/bem-incubator/bem-deps/stargazers","contributors_url":"https://api.github.com/repos/bem-incubator/bem-deps/contributors","subscribers_url":"https://api.github.com/repos/bem-incubator/bem-deps/subscribers","subscription_url":"https://api.github.com/repos/bem-incubator/bem-deps/subscription","commits_url":"https://api.github.com/repos/bem-incubator/bem-deps/commits{/sha}","git_commits_url":"https://api.github.com/repos/bem-incubator/bem-deps/git/commits{/sha}","comments_url":"https://api.github.com/repos/bem-incubator/bem-deps/comments{/number}","issue_comment_url":"https://api.github.com/repos/bem-incubator/bem-deps/issues/comments{/number}","contents_url":"https://api.github.com/repos/bem-incubator/bem-deps/contents/{+path}","compare_url":"https://api.github.com/repos/bem-incubator/bem-deps/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bem-incubator/bem-deps/merges","archive_url":"https://api.github.com/repos/bem-incubator/bem-deps/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bem-incubator/bem-deps/downloads","issues_url":"https://api.github.com/repos/bem-incubator/bem-deps/issues{/number}","pulls_url":"https://api.github.com/repos/bem-incubator/bem-deps/pulls{/number}","milestones_url":"https://api.github.com/repos/bem-incubator/bem-deps/milestones{/number}","notifications_url":"https://api.github.com/repos/bem-incubator/bem-deps/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bem-incubator/bem-deps/labels{/name}","releases_url":"https://api.github.com/repos/bem-incubator/bem-deps/releases{/id}","created_at":"2015-06-04T09:48:14Z","updated_at":"2015-06-04T10:21:51Z","pushed_at":"2015-06-25T13:56:48Z","git_url":"git://github.com/bem-incubator/bem-deps.git","ssh_url":"git@github.com:bem-incubator/bem-deps.git","clone_url":"https://github.com/bem-incubator/bem-deps.git","svn_url":"https://github.com/bem-incubator/bem-deps","homepage":null,"size":360,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":18,"forks":0,"open_issues":18,"watchers":1,"default_branch":"master"}},"base":{"label":"bem-incubator:master","ref":"master","sha":"5fbb7149cea1cf49b32502a0b975643139aa24d6","user":{"login":"bem-incubator","id":10929504,"avatar_url":"https://avatars.githubusercontent.com/u/10929504?v=3","gravatar_id":"","url":"https://api.github.com/users/bem-incubator","html_url":"https://github.com/bem-incubator","followers_url":"https://api.github.com/users/bem-incubator/followers","following_url":"https://api.github.com/users/bem-incubator/following{/other_user}","gists_url":"https://api.github.com/users/bem-incubator/gists{/gist_id}","starred_url":"https://api.github.com/users/bem-incubator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bem-incubator/subscriptions","organizations_url":"https://api.github.com/users/bem-incubator/orgs","repos_url":"https://api.github.com/users/bem-incubator/repos","events_url":"https://api.github.com/users/bem-incubator/events{/privacy}","received_events_url":"https://api.github.com/users/bem-incubator/received_events","type":"Organization","site_admin":false},"repo":{"id":36862023,"name":"bem-deps","full_name":"bem-incubator/bem-deps","owner":{"login":"bem-incubator","id":10929504,"avatar_url":"https://avatars.githubusercontent.com/u/10929504?v=3","gravatar_id":"","url":"https://api.github.com/users/bem-incubator","html_url":"https://github.com/bem-incubator","followers_url":"https://api.github.com/users/bem-incubator/followers","following_url":"https://api.github.com/users/bem-incubator/following{/other_user}","gists_url":"https://api.github.com/users/bem-incubator/gists{/gist_id}","starred_url":"https://api.github.com/users/bem-incubator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bem-incubator/subscriptions","organizations_url":"https://api.github.com/users/bem-incubator/orgs","repos_url":"https://api.github.com/users/bem-incubator/repos","events_url":"https://api.github.com/users/bem-incubator/events{/privacy}","received_events_url":"https://api.github.com/users/bem-incubator/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bem-incubator/bem-deps","description":"","fork":false,"url":"https://api.github.com/repos/bem-incubator/bem-deps","forks_url":"https://api.github.com/repos/bem-incubator/bem-deps/forks","keys_url":"https://api.github.com/repos/bem-incubator/bem-deps/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bem-incubator/bem-deps/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bem-incubator/bem-deps/teams","hooks_url":"https://api.github.com/repos/bem-incubator/bem-deps/hooks","issue_events_url":"https://api.github.com/repos/bem-incubator/bem-deps/issues/events{/number}","events_url":"https://api.github.com/repos/bem-incubator/bem-deps/events","assignees_url":"https://api.github.com/repos/bem-incubator/bem-deps/assignees{/user}","branches_url":"https://api.github.com/repos/bem-incubator/bem-deps/branches{/branch}","tags_url":"https://api.github.com/repos/bem-incubator/bem-deps/tags","blobs_url":"https://api.github.com/repos/bem-incubator/bem-deps/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bem-incubator/bem-deps/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bem-incubator/bem-deps/git/refs{/sha}","trees_url":"https://api.github.com/repos/bem-incubator/bem-deps/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bem-incubator/bem-deps/statuses/{sha}","languages_url":"https://api.github.com/repos/bem-incubator/bem-deps/languages","stargazers_url":"https://api.github.com/repos/bem-incubator/bem-deps/stargazers","contributors_url":"https://api.github.com/repos/bem-incubator/bem-deps/contributors","subscribers_url":"https://api.github.com/repos/bem-incubator/bem-deps/subscribers","subscription_url":"https://api.github.com/repos/bem-incubator/bem-deps/subscription","commits_url":"https://api.github.com/repos/bem-incubator/bem-deps/commits{/sha}","git_commits_url":"https://api.github.com/repos/bem-incubator/bem-deps/git/commits{/sha}","comments_url":"https://api.github.com/repos/bem-incubator/bem-deps/comments{/number}","issue_comment_url":"https://api.github.com/repos/bem-incubator/bem-deps/issues/comments{/number}","contents_url":"https://api.github.com/repos/bem-incubator/bem-deps/contents/{+path}","compare_url":"https://api.github.com/repos/bem-incubator/bem-deps/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bem-incubator/bem-deps/merges","archive_url":"https://api.github.com/repos/bem-incubator/bem-deps/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bem-incubator/bem-deps/downloads","issues_url":"https://api.github.com/repos/bem-incubator/bem-deps/issues{/number}","pulls_url":"https://api.github.com/repos/bem-incubator/bem-deps/pulls{/number}","milestones_url":"https://api.github.com/repos/bem-incubator/bem-deps/milestones{/number}","notifications_url":"https://api.github.com/repos/bem-incubator/bem-deps/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bem-incubator/bem-deps/labels{/name}","releases_url":"https://api.github.com/repos/bem-incubator/bem-deps/releases{/id}","created_at":"2015-06-04T09:48:14Z","updated_at":"2015-06-04T10:21:51Z","pushed_at":"2015-06-25T13:56:48Z","git_url":"git://github.com/bem-incubator/bem-deps.git","ssh_url":"git@github.com:bem-incubator/bem-deps.git","clone_url":"https://github.com/bem-incubator/bem-deps.git","svn_url":"https://github.com/bem-incubator/bem-deps","homepage":null,"size":360,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":18,"forks":0,"open_issues":18,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bem-incubator/bem-deps/pulls/11"},"html":{"href":"https://github.com/bem-incubator/bem-deps/pull/11"},"issue":{"href":"https://api.github.com/repos/bem-incubator/bem-deps/issues/11"},"comments":{"href":"https://api.github.com/repos/bem-incubator/bem-deps/issues/11/comments"},"review_comments":{"href":"https://api.github.com/repos/bem-incubator/bem-deps/pulls/11/comments"},"review_comment":{"href":"https://api.github.com/repos/bem-incubator/bem-deps/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bem-incubator/bem-deps/pulls/11/commits"},"statuses":{"href":"https://api.github.com/repos/bem-incubator/bem-deps/statuses/55baaf5c8c761fd939a48181beb412dedb865b84"}}}}