This repository was archived by the owner on Dec 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 409
Add some instrumentation #1744
Merged
Merged
Add some instrumentation #1744
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
305ba1c
add tracking for cloning repo events
vanessayuenn 5041034
instrumentation for context menu actions
vanessayuenn fc12a77
fix tests
vanessayuenn f95a53f
add unit tests for context menu actions reporting
vanessayuenn 668541d
more detailed spec
vanessayuenn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -342,15 +342,18 @@ describe('RootController', function() { | |
| assert.lengthOf(wrapper.find('Panel').find({location: 'modal'}).find('CloneDialog'), 1); | ||
| }); | ||
|
|
||
| it('triggers the clone callback on accept', function() { | ||
| it('triggers the clone callback on accept and fires `clone-repo` event', async function() { | ||
| sinon.stub(reporterProxy, 'addEvent'); | ||
| wrapper.instance().openCloneDialog(); | ||
| wrapper.update(); | ||
|
|
||
| const dialog = wrapper.find('CloneDialog'); | ||
| dialog.prop('didAccept')('[email protected]:atom/github.git', '/home/me/github'); | ||
| const promise = dialog.prop('didAccept')('[email protected]:atom/github.git', '/home/me/github'); | ||
| resolveClone(); | ||
| await promise; | ||
|
|
||
| assert.isTrue(cloneRepositoryForProjectPath.calledWith('[email protected]:atom/github.git', '/home/me/github')); | ||
| await assert.isTrue(reporterProxy.addEvent.calledWith('clone-repo', {package: 'github'})); | ||
| }); | ||
|
|
||
| it('marks the clone dialog as in progress during clone', async function() { | ||
|
|
@@ -372,8 +375,9 @@ describe('RootController', function() { | |
| assert.isFalse(wrapper.find('CloneDialog').exists()); | ||
| }); | ||
|
|
||
| it('creates a notification if the clone fails', async function() { | ||
| it('creates a notification if the clone fails and does not fire `clone-repo` event', async function() { | ||
| sinon.stub(notificationManager, 'addError'); | ||
| sinon.stub(reporterProxy, 'addEvent'); | ||
|
|
||
| wrapper.instance().openCloneDialog(); | ||
| wrapper.update(); | ||
|
|
@@ -393,6 +397,7 @@ describe('RootController', function() { | |
| 'Unable to clone [email protected]:nope/nope.git', | ||
| sinon.match({detail: sinon.match(/this is stderr/)}), | ||
| )); | ||
| assert.isFalse(reporterProxy.addEvent.called); | ||
| }); | ||
|
|
||
| it('dismisses the clone panel on cancel', function() { | ||
|
|
@@ -1083,4 +1088,49 @@ describe('RootController', function() { | |
| }); | ||
| }); | ||
| }); | ||
|
|
||
| describe('context commands trigger event reporting', function() { | ||
| let wrapper; | ||
|
|
||
| beforeEach(async function() { | ||
| const repository = await buildRepository(await cloneRepository('multiple-commits')); | ||
| app = React.cloneElement(app, { | ||
| repository, | ||
| startOpen: true, | ||
| startRevealed: true, | ||
| }); | ||
| wrapper = mount(app); | ||
| sinon.stub(reporterProxy, 'addEvent'); | ||
| }); | ||
|
|
||
| it('sends an event when a command is triggered via a context menu', function() { | ||
| commandRegistry.dispatch( | ||
| wrapper.find('CommitView').getDOMNode(), | ||
| 'github:toggle-expanded-commit-message-editor', | ||
| [{contextCommand: true}], | ||
| ); | ||
| assert.isTrue(reporterProxy.addEvent.calledWith( | ||
| 'context-menu-action', { | ||
| package: 'github', | ||
| command: 'github:toggle-expanded-commit-message-editor', | ||
| })); | ||
| }); | ||
|
|
||
| it('does not send an event when a command is triggered in other ways', function() { | ||
| commandRegistry.dispatch( | ||
| wrapper.find('CommitView').getDOMNode(), | ||
| 'github:toggle-expanded-commit-message-editor', | ||
| ); | ||
| assert.isFalse(reporterProxy.addEvent.called); | ||
| }); | ||
|
|
||
| it('does not send an event when a command not starting with github: is triggered via a context menu', function() { | ||
| commandRegistry.dispatch( | ||
| wrapper.find('CommitView').getDOMNode(), | ||
| 'core:copy', | ||
| [{contextCommand: true}], | ||
| ); | ||
| assert.isFalse(reporterProxy.addEvent.called); | ||
| }); | ||
| }); | ||
| }); | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.