{"action":"created","comment":{"url":"https://api.github.com/repos/bem-incubator/bem-deps/pulls/comments/32725555","id":32725555,"diff_hunk":"@@ -0,0 +1,816 @@\n+var bemDeps = require('../lib/deps'),\n+    expect =  require('must'),\n+    _ = require('lodash');\n+\n+function isEntityAdded (entities, entity) {\n+    return _.findIndex(entities, entity) !== -1;\n+}\n+\n+describe('resolve', function () {\n+    describe('input processing', function () {\n+        it('should throw error if decl param is not defined', function () {\n+            (function () { bemDeps.resolve(); })\n+                .must.throw('The decl list is not defined. It\\'s impossible to resolve missing decl list');\n+        });\n+\n+        it('should throw error if decl param is empty', function () {\n+            (function () { bemDeps.resolve([]); })\n+                .must.throw('The decl list is empty. It\\'s impossible to resolve empty decl list');\n+        });\n+\n+        it('should return identical decl list if no deps specified', function () {\n+            var decl = [\n+                { block: 'A' }\n+            ];\n+\n+            expect(bemDeps.resolve(decl).entities).to.be.eql(decl);\n+        });\n+\n+        it('should return identical decl list if deps graph is not an array', function () {\n+            var decl = [{ block: 'A' }],\n+                deps = {};\n+\n+            expect(bemDeps.resolve(decl, deps).entities).to.be.eql(decl);\n+        });\n+\n+        it('should return identical decl list for specific tech for unspecified deps declaration', function () {\n+            var decl = [\n+                    { block: 'A' }\n+                ];\n+\n+            expect(bemDeps.resolve(decl, undefined, { tech: 'css' }).entities).to.be.eql([{ block: 'A' }]);\n+        });\n+\n+        it('should return identical decl list for specific tech for empty deps declaration', function () {\n+            var decl = [\n+                    { block: 'A' }\n+                ],\n+                deps = [];\n+\n+            expect(bemDeps.resolve(decl, deps, { tech: 'css' }).entities).to.be.eql([{ block: 'A' }]);\n+        });\n+\n+        it('should ignore tech param if it\\'s format differs from { tech: \\'%tech_name%\\' }', function () {\n+            var decl = [\n+                    { block: 'A' }\n+                ],\n+                deps = [\n+                    {\n+                        entity: { block: 'A' },\n+                        tech: 'css',\n+                        dependOn: [{ entity: { block: 'B' } }]\n+                    }\n+                ],\n+                tech = 'css',\n+                resolved = bemDeps.resolve(decl, deps, tech);\n+\n+            expect(isEntityAdded(resolved.entities, { block: 'B' })).to.be.false();\n+        });\n+    });\n+\n+    describe('resolving basic dependencies', function () {\n+        it('should allow entity to depend 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 = bemDeps.resolve(decl, deps);\n+\n+            expect(isEntityAdded(resolved.entities, { block: 'B' })).to.be.true();","path":"test/resolve.test.js","position":82,"original_position":82,"commit_id":"3e401aee48bfc8d87abe654f35c0abdbac267973","original_commit_id":"3e401aee48bfc8d87abe654f35c0abdbac267973","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":"Слишком точная проверка ^_^. Нам всё же надо быть уверенным, что `A` тоже попадёт в результат.","created_at":"2015-06-18T12:50:52Z","updated_at":"2015-06-18T12:50:52Z","html_url":"https://github.com/bem-incubator/bem-deps/pull/4#discussion_r32725555","pull_request_url":"https://api.github.com/repos/bem-incubator/bem-deps/pulls/4","_links":{"self":{"href":"https://api.github.com/repos/bem-incubator/bem-deps/pulls/comments/32725555"},"html":{"href":"https://github.com/bem-incubator/bem-deps/pull/4#discussion_r32725555"},"pull_request":{"href":"https://api.github.com/repos/bem-incubator/bem-deps/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/bem-incubator/bem-deps/pulls/4","id":37144093,"html_url":"https://github.com/bem-incubator/bem-deps/pull/4","diff_url":"https://github.com/bem-incubator/bem-deps/pull/4.diff","patch_url":"https://github.com/bem-incubator/bem-deps/pull/4.patch","issue_url":"https://api.github.com/repos/bem-incubator/bem-deps/issues/4","number":4,"state":"open","locked":false,"title":"Issue 3","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":"Added basic tests covering input params processing, dependency ordering and exceptions on retain cycles. ","created_at":"2015-06-08T11:30:29Z","updated_at":"2015-06-18T12:50:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"45cbf57f2c14edced88064778a9bcd1b0a3995f2","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/4/commits","review_comments_url":"https://api.github.com/repos/bem-incubator/bem-deps/pulls/4/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/4/comments","statuses_url":"https://api.github.com/repos/bem-incubator/bem-deps/statuses/3e401aee48bfc8d87abe654f35c0abdbac267973","head":{"label":"bem-incubator:issue-3","ref":"issue-3","sha":"3e401aee48bfc8d87abe654f35c0abdbac267973","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-18T10:11:01Z","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":284,"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":4,"forks":0,"open_issues":4,"watchers":1,"default_branch":"master"}},"base":{"label":"bem-incubator:master","ref":"master","sha":"e40e79c8451ec8b7aa7fcbb025bdb2d092bfd89b","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-18T10:11:01Z","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":284,"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":4,"forks":0,"open_issues":4,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bem-incubator/bem-deps/pulls/4"},"html":{"href":"https://github.com/bem-incubator/bem-deps/pull/4"},"issue":{"href":"https://api.github.com/repos/bem-incubator/bem-deps/issues/4"},"comments":{"href":"https://api.github.com/repos/bem-incubator/bem-deps/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/bem-incubator/bem-deps/pulls/4/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/4/commits"},"statuses":{"href":"https://api.github.com/repos/bem-incubator/bem-deps/statuses/3e401aee48bfc8d87abe654f35c0abdbac267973"}}}}