{"action":"created","comment":{"url":"https://api.github.com/repos/bianruanjian/client-api/pulls/comments/220088043","pull_request_review_id":158412804,"id":220088043,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMDA4ODA0Mw==","diff_hunk":"@@ -0,0 +1,77 @@\n+import { describe, it, beforeEach } from \"intern/lib/interfaces/bdd\";\r\n+const { assert } = intern.getPlugin('chai');\r\n+import { Store } from '@dojo/framework/stores/Store';\r\n+import global from '@dojo/shim/global';\r\n+import setData from '../../../src/api/setData';\r\n+import { StateData } from '../../../src/interface';\r\n+\r\n+describe('setData', () => {\r\n+    let store: Store<any>;\r\n+    let stateData: StateData;\r\n+    beforeEach(() => {\r\n+        store = global.store = new Store();\r\n+    })\r\n+\r\n+    it('without global store should throw an error', () => {\r\n+        global.store = null;\r\n+        stateData = {\r\n+            foo: 'test'\r\n+        };\r\n+        assert.throws(() => { setData(stateData) }, Error, '未找到 store，请设置 global.store');\r\n+    })\r\n+\r\n+    it('add foo', () => {\r\n+        stateData = {\r\n+            foo: 'test'\r\n+        };\r\n+        setData(stateData);\r\n+        assert.strictEqual(store.get(store.path('foo')), 'test');\r\n+    })\r\n+\r\n+\r\n+    it('add two objects', () => {\r\n+        stateData = {\r\n+            'foo': 'test1',\r\n+            'bar': 'test2'\r\n+        };\r\n+        setData(stateData);\r\n+        assert.deepEqual(store.get(store.path('foo')), 'test1');\r\n+        assert.strictEqual(store.get(store.path('bar')), 'test2');\r\n+    })\r\n+\r\n+    it('add foo.bar', () => {\r\n+        stateData = {\r\n+            'foo.bar': 'test'\r\n+        };\r\n+        setData(stateData);\r\n+        assert.deepEqual(store.get(store.path('foo')), { bar: 'test' });\r\n+        assert.strictEqual(store.get(store.path('foo/bar')), 'test');\r\n+    })\r\n+\r\n+    it('add foo.bar.a', () => {\r\n+        stateData = {\r\n+            'foo.bar.a': 'test'\r\n+        };\r\n+        setData(stateData);\r\n+        assert.strictEqual(store.get(store.path('foo/bar/a')), 'test');\r\n+    })\r\n+\r\n+    it('add foo[2].bar', () => {\r\n+        stateData = {\r\n+            'foo[2].bar': 'test'\r\n+        };\r\n+        setData(stateData);\r\n+        assert.deepEqual(store.get(store.path('foo')), [, , { bar: 'test' }]);\r\n+        assert.strictEqual(store.get(store.path('foo/2/bar')), 'test');\r\n+    })\r\n+\r\n+    it('add foo[0][\"bar\"]', () => {\r\n+        stateData = {\r\n+            'foo[0][\"bar\"]': 'test'\r\n+        };\r\n+        setData(stateData);\r\n+        assert.deepEqual(store.get(store.path('foo')), [{ bar: 'test' }]);\r\n+        assert.strictEqual(store.get(store.path('foo/0/bar')), 'test');\r\n+    })\r","path":"tests/unit/api/setData.ts","position":75,"original_position":75,"commit_id":"68e6225c0efbc58326215ac2fe0e2b78f4f27c02","original_commit_id":"68e6225c0efbc58326215ac2fe0e2b78f4f27c02","user":{"login":"xiaohulu","id":624517,"node_id":"MDQ6VXNlcjYyNDUxNw==","avatar_url":"https://avatars2.githubusercontent.com/u/624517?v=4","gravatar_id":"","url":"https://api.github.com/users/xiaohulu","html_url":"https://github.com/xiaohulu","followers_url":"https://api.github.com/users/xiaohulu/followers","following_url":"https://api.github.com/users/xiaohulu/following{/other_user}","gists_url":"https://api.github.com/users/xiaohulu/gists{/gist_id}","starred_url":"https://api.github.com/users/xiaohulu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xiaohulu/subscriptions","organizations_url":"https://api.github.com/users/xiaohulu/orgs","repos_url":"https://api.github.com/users/xiaohulu/repos","events_url":"https://api.github.com/users/xiaohulu/events{/privacy}","received_events_url":"https://api.github.com/users/xiaohulu/received_events","type":"User","site_admin":false},"body":"测试下单引号的情况。","created_at":"2018-09-25T07:45:58Z","updated_at":"2018-09-25T07:45:58Z","html_url":"https://github.com/bianruanjian/client-api/pull/2#discussion_r220088043","pull_request_url":"https://api.github.com/repos/bianruanjian/client-api/pulls/2","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/bianruanjian/client-api/pulls/comments/220088043"},"html":{"href":"https://github.com/bianruanjian/client-api/pull/2#discussion_r220088043"},"pull_request":{"href":"https://api.github.com/repos/bianruanjian/client-api/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/bianruanjian/client-api/pulls/2","id":217203705,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE3MjAzNzA1","html_url":"https://github.com/bianruanjian/client-api/pull/2","diff_url":"https://github.com/bianruanjian/client-api/pull/2.diff","patch_url":"https://github.com/bianruanjian/client-api/pull/2.patch","issue_url":"https://api.github.com/repos/bianruanjian/client-api/issues/2","number":2,"state":"open","locked":false,"title":"Add set data component","user":{"login":"byg","id":7710952,"node_id":"MDQ6VXNlcjc3MTA5NTI=","avatar_url":"https://avatars2.githubusercontent.com/u/7710952?v=4","gravatar_id":"","url":"https://api.github.com/users/byg","html_url":"https://github.com/byg","followers_url":"https://api.github.com/users/byg/followers","following_url":"https://api.github.com/users/byg/following{/other_user}","gists_url":"https://api.github.com/users/byg/gists{/gist_id}","starred_url":"https://api.github.com/users/byg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/byg/subscriptions","organizations_url":"https://api.github.com/users/byg/orgs","repos_url":"https://api.github.com/users/byg/repos","events_url":"https://api.github.com/users/byg/events{/privacy}","received_events_url":"https://api.github.com/users/byg/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-09-21T08:09:34Z","updated_at":"2018-09-25T07:45:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b52f9e8ae3a4379ad78f25d21426230109aa816b","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/bianruanjian/client-api/pulls/2/commits","review_comments_url":"https://api.github.com/repos/bianruanjian/client-api/pulls/2/comments","review_comment_url":"https://api.github.com/repos/bianruanjian/client-api/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bianruanjian/client-api/issues/2/comments","statuses_url":"https://api.github.com/repos/bianruanjian/client-api/statuses/68e6225c0efbc58326215ac2fe0e2b78f4f27c02","head":{"label":"bianruanjian:add_setData_component","ref":"add_setData_component","sha":"68e6225c0efbc58326215ac2fe0e2b78f4f27c02","user":{"login":"bianruanjian","id":33917699,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMzOTE3Njk5","avatar_url":"https://avatars2.githubusercontent.com/u/33917699?v=4","gravatar_id":"","url":"https://api.github.com/users/bianruanjian","html_url":"https://github.com/bianruanjian","followers_url":"https://api.github.com/users/bianruanjian/followers","following_url":"https://api.github.com/users/bianruanjian/following{/other_user}","gists_url":"https://api.github.com/users/bianruanjian/gists{/gist_id}","starred_url":"https://api.github.com/users/bianruanjian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bianruanjian/subscriptions","organizations_url":"https://api.github.com/users/bianruanjian/orgs","repos_url":"https://api.github.com/users/bianruanjian/repos","events_url":"https://api.github.com/users/bianruanjian/events{/privacy}","received_events_url":"https://api.github.com/users/bianruanjian/received_events","type":"Organization","site_admin":false},"repo":{"id":148294211,"node_id":"MDEwOlJlcG9zaXRvcnkxNDgyOTQyMTE=","name":"client-api","full_name":"bianruanjian/client-api","private":false,"owner":{"login":"bianruanjian","id":33917699,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMzOTE3Njk5","avatar_url":"https://avatars2.githubusercontent.com/u/33917699?v=4","gravatar_id":"","url":"https://api.github.com/users/bianruanjian","html_url":"https://github.com/bianruanjian","followers_url":"https://api.github.com/users/bianruanjian/followers","following_url":"https://api.github.com/users/bianruanjian/following{/other_user}","gists_url":"https://api.github.com/users/bianruanjian/gists{/gist_id}","starred_url":"https://api.github.com/users/bianruanjian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bianruanjian/subscriptions","organizations_url":"https://api.github.com/users/bianruanjian/orgs","repos_url":"https://api.github.com/users/bianruanjian/repos","events_url":"https://api.github.com/users/bianruanjian/events{/privacy}","received_events_url":"https://api.github.com/users/bianruanjian/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/bianruanjian/client-api","description":"客户端 API","fork":false,"url":"https://api.github.com/repos/bianruanjian/client-api","forks_url":"https://api.github.com/repos/bianruanjian/client-api/forks","keys_url":"https://api.github.com/repos/bianruanjian/client-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bianruanjian/client-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bianruanjian/client-api/teams","hooks_url":"https://api.github.com/repos/bianruanjian/client-api/hooks","issue_events_url":"https://api.github.com/repos/bianruanjian/client-api/issues/events{/number}","events_url":"https://api.github.com/repos/bianruanjian/client-api/events","assignees_url":"https://api.github.com/repos/bianruanjian/client-api/assignees{/user}","branches_url":"https://api.github.com/repos/bianruanjian/client-api/branches{/branch}","tags_url":"https://api.github.com/repos/bianruanjian/client-api/tags","blobs_url":"https://api.github.com/repos/bianruanjian/client-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bianruanjian/client-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bianruanjian/client-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/bianruanjian/client-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bianruanjian/client-api/statuses/{sha}","languages_url":"https://api.github.com/repos/bianruanjian/client-api/languages","stargazers_url":"https://api.github.com/repos/bianruanjian/client-api/stargazers","contributors_url":"https://api.github.com/repos/bianruanjian/client-api/contributors","subscribers_url":"https://api.github.com/repos/bianruanjian/client-api/subscribers","subscription_url":"https://api.github.com/repos/bianruanjian/client-api/subscription","commits_url":"https://api.github.com/repos/bianruanjian/client-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/bianruanjian/client-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/bianruanjian/client-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/bianruanjian/client-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/bianruanjian/client-api/contents/{+path}","compare_url":"https://api.github.com/repos/bianruanjian/client-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bianruanjian/client-api/merges","archive_url":"https://api.github.com/repos/bianruanjian/client-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bianruanjian/client-api/downloads","issues_url":"https://api.github.com/repos/bianruanjian/client-api/issues{/number}","pulls_url":"https://api.github.com/repos/bianruanjian/client-api/pulls{/number}","milestones_url":"https://api.github.com/repos/bianruanjian/client-api/milestones{/number}","notifications_url":"https://api.github.com/repos/bianruanjian/client-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bianruanjian/client-api/labels{/name}","releases_url":"https://api.github.com/repos/bianruanjian/client-api/releases{/id}","deployments_url":"https://api.github.com/repos/bianruanjian/client-api/deployments","created_at":"2018-09-11T09:36:03Z","updated_at":"2018-09-18T03:54:25Z","pushed_at":"2018-09-21T09:22:17Z","git_url":"git://github.com/bianruanjian/client-api.git","ssh_url":"git@github.com:bianruanjian/client-api.git","clone_url":"https://github.com/bianruanjian/client-api.git","svn_url":"https://github.com/bianruanjian/client-api","homepage":"https://bianruanjian.github.io/client-api/","size":926,"stargazers_count":1,"watchers_count":1,"language":"CSS","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"bianruanjian:master","ref":"master","sha":"3dd72bdc6a3ece1ac70931dfe934ce81452d987e","user":{"login":"bianruanjian","id":33917699,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMzOTE3Njk5","avatar_url":"https://avatars2.githubusercontent.com/u/33917699?v=4","gravatar_id":"","url":"https://api.github.com/users/bianruanjian","html_url":"https://github.com/bianruanjian","followers_url":"https://api.github.com/users/bianruanjian/followers","following_url":"https://api.github.com/users/bianruanjian/following{/other_user}","gists_url":"https://api.github.com/users/bianruanjian/gists{/gist_id}","starred_url":"https://api.github.com/users/bianruanjian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bianruanjian/subscriptions","organizations_url":"https://api.github.com/users/bianruanjian/orgs","repos_url":"https://api.github.com/users/bianruanjian/repos","events_url":"https://api.github.com/users/bianruanjian/events{/privacy}","received_events_url":"https://api.github.com/users/bianruanjian/received_events","type":"Organization","site_admin":false},"repo":{"id":148294211,"node_id":"MDEwOlJlcG9zaXRvcnkxNDgyOTQyMTE=","name":"client-api","full_name":"bianruanjian/client-api","private":false,"owner":{"login":"bianruanjian","id":33917699,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMzOTE3Njk5","avatar_url":"https://avatars2.githubusercontent.com/u/33917699?v=4","gravatar_id":"","url":"https://api.github.com/users/bianruanjian","html_url":"https://github.com/bianruanjian","followers_url":"https://api.github.com/users/bianruanjian/followers","following_url":"https://api.github.com/users/bianruanjian/following{/other_user}","gists_url":"https://api.github.com/users/bianruanjian/gists{/gist_id}","starred_url":"https://api.github.com/users/bianruanjian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bianruanjian/subscriptions","organizations_url":"https://api.github.com/users/bianruanjian/orgs","repos_url":"https://api.github.com/users/bianruanjian/repos","events_url":"https://api.github.com/users/bianruanjian/events{/privacy}","received_events_url":"https://api.github.com/users/bianruanjian/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/bianruanjian/client-api","description":"客户端 API","fork":false,"url":"https://api.github.com/repos/bianruanjian/client-api","forks_url":"https://api.github.com/repos/bianruanjian/client-api/forks","keys_url":"https://api.github.com/repos/bianruanjian/client-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bianruanjian/client-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bianruanjian/client-api/teams","hooks_url":"https://api.github.com/repos/bianruanjian/client-api/hooks","issue_events_url":"https://api.github.com/repos/bianruanjian/client-api/issues/events{/number}","events_url":"https://api.github.com/repos/bianruanjian/client-api/events","assignees_url":"https://api.github.com/repos/bianruanjian/client-api/assignees{/user}","branches_url":"https://api.github.com/repos/bianruanjian/client-api/branches{/branch}","tags_url":"https://api.github.com/repos/bianruanjian/client-api/tags","blobs_url":"https://api.github.com/repos/bianruanjian/client-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bianruanjian/client-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bianruanjian/client-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/bianruanjian/client-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bianruanjian/client-api/statuses/{sha}","languages_url":"https://api.github.com/repos/bianruanjian/client-api/languages","stargazers_url":"https://api.github.com/repos/bianruanjian/client-api/stargazers","contributors_url":"https://api.github.com/repos/bianruanjian/client-api/contributors","subscribers_url":"https://api.github.com/repos/bianruanjian/client-api/subscribers","subscription_url":"https://api.github.com/repos/bianruanjian/client-api/subscription","commits_url":"https://api.github.com/repos/bianruanjian/client-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/bianruanjian/client-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/bianruanjian/client-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/bianruanjian/client-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/bianruanjian/client-api/contents/{+path}","compare_url":"https://api.github.com/repos/bianruanjian/client-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bianruanjian/client-api/merges","archive_url":"https://api.github.com/repos/bianruanjian/client-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bianruanjian/client-api/downloads","issues_url":"https://api.github.com/repos/bianruanjian/client-api/issues{/number}","pulls_url":"https://api.github.com/repos/bianruanjian/client-api/pulls{/number}","milestones_url":"https://api.github.com/repos/bianruanjian/client-api/milestones{/number}","notifications_url":"https://api.github.com/repos/bianruanjian/client-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bianruanjian/client-api/labels{/name}","releases_url":"https://api.github.com/repos/bianruanjian/client-api/releases{/id}","deployments_url":"https://api.github.com/repos/bianruanjian/client-api/deployments","created_at":"2018-09-11T09:36:03Z","updated_at":"2018-09-18T03:54:25Z","pushed_at":"2018-09-21T09:22:17Z","git_url":"git://github.com/bianruanjian/client-api.git","ssh_url":"git@github.com:bianruanjian/client-api.git","clone_url":"https://github.com/bianruanjian/client-api.git","svn_url":"https://github.com/bianruanjian/client-api","homepage":"https://bianruanjian.github.io/client-api/","size":926,"stargazers_count":1,"watchers_count":1,"language":"CSS","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bianruanjian/client-api/pulls/2"},"html":{"href":"https://github.com/bianruanjian/client-api/pull/2"},"issue":{"href":"https://api.github.com/repos/bianruanjian/client-api/issues/2"},"comments":{"href":"https://api.github.com/repos/bianruanjian/client-api/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/bianruanjian/client-api/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/bianruanjian/client-api/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bianruanjian/client-api/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/bianruanjian/client-api/statuses/68e6225c0efbc58326215ac2fe0e2b78f4f27c02"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"xiaohulu"}}