Skip to content

Commit

Permalink
Remove old tests superseded by telemetry.spec
Browse files Browse the repository at this point in the history
- cli.spec#028 superseded by telemetry.spec.T017-T019
- part of cli.spec#029 superseded by telemetry.spec.T020
- cli.spec#031-032 superseded by telemetry.spec.T022-T023
  • Loading branch information
raphinesse committed Oct 16, 2019
1 parent 3df0871 commit c7af7cd
Showing 1 changed file with 1 addition and 45 deletions.
46 changes: 1 addition & 45 deletions spec/cli.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,37 +292,10 @@ describe('cordova cli', () => {
});
});

it('Test#028 : opts-out if prompt times out AND it tracks opt-out', () => {
// Remove any optOut settings that might have been saved
// ... and force prompt to be shown
telemetry.clear();

// We override telemetry timeout here so we don't need to wait
// 30 seconds. 0s is impossible with the current implementation.
telemetry.timeoutInSecs = 0.01;

// Don't display the prompt
spyOn(process.stdout, 'write');

telemetry.isOptedIn.and.callThrough();
telemetry.showPrompt.and.callThrough();
telemetry.hasUserOptedInOrOut.and.returnValue(false);

return cli(['node', 'cordova', '--version']).then(() => {
if (process.env.CI) {
expect(telemetry.isOptedIn()).toBeTruthy();
} else {
expect(telemetry.isOptedIn()).toBeFalsy();
}
expect(telemetry.track).toHaveBeenCalledWith('telemetry', 'off', 'via-cli-prompt-choice', 'successful');
});
});

it("Test#029 : is NOT collected in CI environments and doesn't prompt", () => {
it('Test#029 : is NOT collected in CI environments', () => {
telemetry.isCI.and.returnValue(true);

return cli(['node', 'cordova', '--version']).then(() => {
expect(telemetry.showPrompt).not.toHaveBeenCalled();
expect(telemetry.track).not.toHaveBeenCalled();
});
});
Expand All @@ -336,23 +309,6 @@ describe('cordova cli', () => {
});
});

it('Test#031 : is NOT collected if user opted out', () => {
telemetry.isOptedIn.and.returnValue(false);
telemetry.hasUserOptedInOrOut.and.returnValue(true);

return cli(['node', 'cordova', '--version']).then(() => {
expect(telemetry.showPrompt).not.toHaveBeenCalled();
expect(telemetry.track).not.toHaveBeenCalled();
});
});

it('Test#032 : is collected if user opted in', () => {
return cli(['node', 'cordova', '--version']).then(() => {
expect(telemetry.showPrompt).not.toHaveBeenCalled();
expect(telemetry.track).toHaveBeenCalled();
});
});

it("Test#033 : track opt-out that happened via 'cordova telemetry off' even if user is NOT opted-in ", () => {
telemetry.isOptedIn.and.returnValue(false);

Expand Down

0 comments on commit c7af7cd

Please # to comment.