@@ -37,7 +37,6 @@ describe('onAcceptance', function () {
37
37
it ( 'Should enqueue an event object to tracker' , async function ( ) {
38
38
const mockEditor = createMockTextEditor ( )
39
39
const trackerSpy = sinon . spy ( CodeWhispererTracker . prototype , 'enqueue' )
40
- const extensionContext = await FakeExtensionContext . create ( )
41
40
const fakeReferences = [
42
41
{
43
42
message : '' ,
@@ -49,22 +48,19 @@ describe('onAcceptance', function () {
49
48
} ,
50
49
} ,
51
50
]
52
- await onAcceptance (
53
- {
54
- editor : mockEditor ,
55
- range : new vscode . Range ( new vscode . Position ( 1 , 0 ) , new vscode . Position ( 1 , 26 ) ) ,
56
- effectiveRange : new vscode . Range ( new vscode . Position ( 1 , 0 ) , new vscode . Position ( 1 , 26 ) ) ,
57
- acceptIndex : 0 ,
58
- recommendation : "print('Hello World!')" ,
59
- requestId : '' ,
60
- sessionId : '' ,
61
- triggerType : 'OnDemand' ,
62
- completionType : 'Line' ,
63
- language : 'python' ,
64
- references : fakeReferences ,
65
- } ,
66
- extensionContext . globalState
67
- )
51
+ await onAcceptance ( {
52
+ editor : mockEditor ,
53
+ range : new vscode . Range ( new vscode . Position ( 1 , 0 ) , new vscode . Position ( 1 , 26 ) ) ,
54
+ effectiveRange : new vscode . Range ( new vscode . Position ( 1 , 0 ) , new vscode . Position ( 1 , 26 ) ) ,
55
+ acceptIndex : 0 ,
56
+ recommendation : "print('Hello World!')" ,
57
+ requestId : '' ,
58
+ sessionId : '' ,
59
+ triggerType : 'OnDemand' ,
60
+ completionType : 'Line' ,
61
+ language : 'python' ,
62
+ references : fakeReferences ,
63
+ } )
68
64
const actualArg = trackerSpy . getCall ( 0 ) . args [ 0 ] as AcceptedSuggestionEntry
69
65
assert . ok ( trackerSpy . calledOnce )
70
66
assert . strictEqual ( actualArg . originalString , 'def two_sum(nums, target):' )
@@ -79,7 +75,7 @@ describe('onAcceptance', function () {
79
75
} )
80
76
81
77
it ( 'Should report telemetry that records this user decision event' , async function ( ) {
82
- await globals . context . globalState . update ( 'CODEWHISPERER_USER_GROUP' , {
78
+ await globals . globalState . update ( 'CODEWHISPERER_USER_GROUP' , {
83
79
group : UserGroup . Control ,
84
80
version : extensionVersion ,
85
81
} )
@@ -97,23 +93,19 @@ describe('onAcceptance', function () {
97
93
session . triggerType = 'OnDemand'
98
94
session . setCompletionType ( 0 , session . recommendations [ 0 ] )
99
95
const assertTelemetry = assertTelemetryCurried ( 'codewhisperer_userDecision' )
100
- const extensionContext = await FakeExtensionContext . create ( )
101
- await onAcceptance (
102
- {
103
- editor : mockEditor ,
104
- range : new vscode . Range ( new vscode . Position ( 1 , 0 ) , new vscode . Position ( 1 , 21 ) ) ,
105
- effectiveRange : new vscode . Range ( new vscode . Position ( 1 , 0 ) , new vscode . Position ( 1 , 26 ) ) ,
106
- acceptIndex : 0 ,
107
- recommendation : "print('Hello World!')" ,
108
- requestId : '' ,
109
- sessionId : '' ,
110
- triggerType : 'OnDemand' ,
111
- completionType : 'Line' ,
112
- language : 'python' ,
113
- references : undefined ,
114
- } ,
115
- extensionContext . globalState
116
- )
96
+ await onAcceptance ( {
97
+ editor : mockEditor ,
98
+ range : new vscode . Range ( new vscode . Position ( 1 , 0 ) , new vscode . Position ( 1 , 21 ) ) ,
99
+ effectiveRange : new vscode . Range ( new vscode . Position ( 1 , 0 ) , new vscode . Position ( 1 , 26 ) ) ,
100
+ acceptIndex : 0 ,
101
+ recommendation : "print('Hello World!')" ,
102
+ requestId : '' ,
103
+ sessionId : '' ,
104
+ triggerType : 'OnDemand' ,
105
+ completionType : 'Line' ,
106
+ language : 'python' ,
107
+ references : undefined ,
108
+ } )
117
109
assertTelemetry ( {
118
110
codewhispererRequestId : 'test' ,
119
111
codewhispererSessionId : 'test' ,
0 commit comments