Skip to content

Commit bb7c4f5

Browse files
committed
fixup token
1 parent 002e44a commit bb7c4f5

File tree

1 file changed

+25
-20
lines changed

1 file changed

+25
-20
lines changed

src/notebooks/deepnote/deepnoteInputBlockCellStatusBarProvider.unit.test.ts

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import { expect } from 'chai';
55
import { anything, verify, when } from 'ts-mockito';
66

7-
import { NotebookCell, NotebookCellKind, NotebookDocument, Uri } from 'vscode';
7+
import { CancellationToken, NotebookCell, NotebookCellKind, NotebookDocument, Uri } from 'vscode';
88

99
import type { IExtensionContext } from '../../platform/common/types';
1010
import { mockedVSCodeNamespaces, resetVSCodeMocks } from '../../test/vscode-mock';
@@ -13,11 +13,16 @@ import { DeepnoteInputBlockCellStatusBarItemProvider } from './deepnoteInputBloc
1313
suite('DeepnoteInputBlockCellStatusBarItemProvider', () => {
1414
let provider: DeepnoteInputBlockCellStatusBarItemProvider;
1515
let mockExtensionContext: IExtensionContext;
16+
let mockToken: CancellationToken;
1617

1718
setup(() => {
1819
mockExtensionContext = {
1920
subscriptions: []
2021
} as any;
22+
mockToken = {
23+
isCancellationRequested: false,
24+
onCancellationRequested: () => ({ dispose: () => {} })
25+
} as any;
2126
provider = new DeepnoteInputBlockCellStatusBarItemProvider(mockExtensionContext);
2227
});
2328

@@ -60,7 +65,7 @@ suite('DeepnoteInputBlockCellStatusBarItemProvider', () => {
6065
suite('Input Block Type Detection', () => {
6166
test('Should return status bar items for input-text block', () => {
6267
const cell = createMockCell({ __deepnotePocket: { type: 'input-text' } });
63-
const items = provider.provideCellStatusBarItems(cell);
68+
const items = provider.provideCellStatusBarItems(cell, mockToken);
6469

6570
expect(items).to.not.be.undefined;
6671
expect(items).to.have.length.at.least(2);
@@ -70,7 +75,7 @@ suite('DeepnoteInputBlockCellStatusBarItemProvider', () => {
7075

7176
test('Should return status bar items for input-textarea block', () => {
7277
const cell = createMockCell({ __deepnotePocket: { type: 'input-textarea' } });
73-
const items = provider.provideCellStatusBarItems(cell);
78+
const items = provider.provideCellStatusBarItems(cell, mockToken);
7479

7580
expect(items).to.not.be.undefined;
7681
expect(items).to.have.length.at.least(2);
@@ -79,7 +84,7 @@ suite('DeepnoteInputBlockCellStatusBarItemProvider', () => {
7984

8085
test('Should return status bar items for input-select block', () => {
8186
const cell = createMockCell({ __deepnotePocket: { type: 'input-select' } });
82-
const items = provider.provideCellStatusBarItems(cell);
87+
const items = provider.provideCellStatusBarItems(cell, mockToken);
8388

8489
expect(items).to.not.be.undefined;
8590
expect(items).to.have.length.at.least(2); // Type label, variable, and selection button
@@ -88,7 +93,7 @@ suite('DeepnoteInputBlockCellStatusBarItemProvider', () => {
8893

8994
test('Should return status bar items for input-slider block', () => {
9095
const cell = createMockCell({ __deepnotePocket: { type: 'input-slider' } });
91-
const items = provider.provideCellStatusBarItems(cell);
96+
const items = provider.provideCellStatusBarItems(cell, mockToken);
9297

9398
expect(items).to.not.be.undefined;
9499
expect(items).to.have.length.at.least(2); // Type label, variable, min, and max buttons
@@ -97,7 +102,7 @@ suite('DeepnoteInputBlockCellStatusBarItemProvider', () => {
97102

98103
test('Should return status bar items for input-checkbox block', () => {
99104
const cell = createMockCell({ __deepnotePocket: { type: 'input-checkbox' } });
100-
const items = provider.provideCellStatusBarItems(cell);
105+
const items = provider.provideCellStatusBarItems(cell, mockToken);
101106

102107
expect(items).to.not.be.undefined;
103108
expect(items).to.have.length.at.least(2); // Type label, variable, and toggle button
@@ -106,7 +111,7 @@ suite('DeepnoteInputBlockCellStatusBarItemProvider', () => {
106111

107112
test('Should return status bar items for input-date block', () => {
108113
const cell = createMockCell({ __deepnotePocket: { type: 'input-date' } });
109-
const items = provider.provideCellStatusBarItems(cell);
114+
const items = provider.provideCellStatusBarItems(cell, mockToken);
110115

111116
expect(items).to.not.be.undefined;
112117
expect(items).to.have.length.at.least(2); // Type label, variable, and date button
@@ -115,7 +120,7 @@ suite('DeepnoteInputBlockCellStatusBarItemProvider', () => {
115120

116121
test('Should return status bar items for input-date-range block', () => {
117122
const cell = createMockCell({ __deepnotePocket: { type: 'input-date-range' } });
118-
const items = provider.provideCellStatusBarItems(cell);
123+
const items = provider.provideCellStatusBarItems(cell, mockToken);
119124

120125
expect(items).to.not.be.undefined;
121126
expect(items).to.have.length.at.least(2); // Type label, variable, start, and end buttons
@@ -124,7 +129,7 @@ suite('DeepnoteInputBlockCellStatusBarItemProvider', () => {
124129

125130
test('Should return status bar items for input-file block', () => {
126131
const cell = createMockCell({ __deepnotePocket: { type: 'input-file' } });
127-
const items = provider.provideCellStatusBarItems(cell);
132+
const items = provider.provideCellStatusBarItems(cell, mockToken);
128133

129134
expect(items).to.not.be.undefined;
130135
expect(items).to.have.lengthOf(3); // Type label, variable, and choose file button
@@ -133,7 +138,7 @@ suite('DeepnoteInputBlockCellStatusBarItemProvider', () => {
133138

134139
test('Should return status bar items for button block', () => {
135140
const cell = createMockCell({ __deepnotePocket: { type: 'button' } });
136-
const items = provider.provideCellStatusBarItems(cell);
141+
const items = provider.provideCellStatusBarItems(cell, mockToken);
137142

138143
expect(items).to.not.be.undefined;
139144
expect(items).to.have.length.at.least(2);
@@ -144,35 +149,35 @@ suite('DeepnoteInputBlockCellStatusBarItemProvider', () => {
144149
suite('Non-Input Block Types', () => {
145150
test('Should return undefined for code block', () => {
146151
const cell = createMockCell({ __deepnotePocket: { type: 'code' } });
147-
const items = provider.provideCellStatusBarItems(cell);
152+
const items = provider.provideCellStatusBarItems(cell, mockToken);
148153

149154
expect(items).to.be.undefined;
150155
});
151156

152157
test('Should return undefined for sql block', () => {
153158
const cell = createMockCell({ __deepnotePocket: { type: 'sql' } });
154-
const items = provider.provideCellStatusBarItems(cell);
159+
const items = provider.provideCellStatusBarItems(cell, mockToken);
155160

156161
expect(items).to.be.undefined;
157162
});
158163

159164
test('Should return undefined for markdown block', () => {
160165
const cell = createMockCell({ __deepnotePocket: { type: 'text-cell-p' } });
161-
const items = provider.provideCellStatusBarItems(cell);
166+
const items = provider.provideCellStatusBarItems(cell, mockToken);
162167

163168
expect(items).to.be.undefined;
164169
});
165170

166171
test('Should return undefined for cell with no type metadata', () => {
167172
const cell = createMockCell({});
168-
const items = provider.provideCellStatusBarItems(cell);
173+
const items = provider.provideCellStatusBarItems(cell, mockToken);
169174

170175
expect(items).to.be.undefined;
171176
});
172177

173178
test('Should return undefined for cell with undefined metadata', () => {
174179
const cell = createMockCell(undefined);
175-
const items = provider.provideCellStatusBarItems(cell);
180+
const items = provider.provideCellStatusBarItems(cell, mockToken);
176181

177182
expect(items).to.be.undefined;
178183
});
@@ -181,21 +186,21 @@ suite('DeepnoteInputBlockCellStatusBarItemProvider', () => {
181186
suite('Status Bar Item Properties', () => {
182187
test('Should have correct tooltip for input-text', () => {
183188
const cell = createMockCell({ __deepnotePocket: { type: 'input-text' } });
184-
const items = provider.provideCellStatusBarItems(cell);
189+
const items = provider.provideCellStatusBarItems(cell, mockToken);
185190

186191
expect(items?.[0].tooltip).to.equal('Deepnote Input Text');
187192
});
188193

189194
test('Should have correct tooltip for button', () => {
190195
const cell = createMockCell({ __deepnotePocket: { type: 'button' } });
191-
const items = provider.provideCellStatusBarItems(cell);
196+
const items = provider.provideCellStatusBarItems(cell, mockToken);
192197

193198
expect(items?.[0].tooltip).to.equal('Deepnote Button');
194199
});
195200

196201
test('Should format multi-word block types correctly', () => {
197202
const cell = createMockCell({ __deepnotePocket: { type: 'input-date-range' } });
198-
const items = provider.provideCellStatusBarItems(cell);
203+
const items = provider.provideCellStatusBarItems(cell, mockToken);
199204

200205
expect(items?.[0].text).to.equal('Input Date Range');
201206
expect(items?.[0].tooltip).to.equal('Deepnote Input Date Range');
@@ -205,15 +210,15 @@ suite('DeepnoteInputBlockCellStatusBarItemProvider', () => {
205210
suite('Case Insensitivity', () => {
206211
test('Should handle uppercase block type', () => {
207212
const cell = createMockCell({ __deepnotePocket: { type: 'INPUT-TEXT' } });
208-
const items = provider.provideCellStatusBarItems(cell);
213+
const items = provider.provideCellStatusBarItems(cell, mockToken);
209214

210215
expect(items).to.not.be.undefined;
211216
expect(items?.[0].text).to.equal('INPUT TEXT');
212217
});
213218

214219
test('Should handle mixed case block type', () => {
215220
const cell = createMockCell({ __deepnotePocket: { type: 'Input-Text' } });
216-
const items = provider.provideCellStatusBarItems(cell);
221+
const items = provider.provideCellStatusBarItems(cell, mockToken);
217222

218223
expect(items).to.not.be.undefined;
219224
expect(items?.[0].text).to.equal('Input Text');

0 commit comments

Comments
 (0)