Skip to content

Commit 0c6d178

Browse files
committed
some more cleaning
1 parent 86a154d commit 0c6d178

2 files changed

Lines changed: 22 additions & 23 deletions

File tree

packages/vscode-extension/tests/specs/webviews/params.spec.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ import {
1313

1414
//** Checks that the query result for each statement containts the expected summaries in query details.
1515
// If we pass an expected summary that is undefined we expect an empty result from query execution */
16-
export async function expectSummaries(
17-
expectedSummaries: (string | undefined)[],
16+
export async function expectSummariesContain(
17+
expectedSubstrings: (string | undefined)[],
1818
) {
1919
const queryDetails = await $$('#queryDetails .collapsible');
20-
await expect(queryDetails.length).toBe(expectedSummaries.length);
20+
await expect(queryDetails.length).toBe(expectedSubstrings.length);
2121

22-
for (let i = 0; i < expectedSummaries.length; i++) {
22+
for (let i = 0; i < expectedSubstrings.length; i++) {
2323
const queryDetail = (await $$('#queryDetails .collapsible'))[i];
2424
//This matches the expand/collapse button, but we only want to click when collapsed
2525
const expandButton = await queryDetail.$('button[aria-label*="statement"]');
@@ -31,8 +31,8 @@ export async function expectSummaries(
3131
const queryResult = await queryDetail.$('.collapsible-content');
3232
await queryResult.waitForDisplayed();
3333
const summary = await queryResult.getText();
34-
if (expectedSummaries[i] !== undefined) {
35-
await expect(summary).toContain(expectedSummaries[i]);
34+
if (expectedSubstrings[i] !== undefined) {
35+
await expect(summary).toContain(expectedSubstrings[i]);
3636
} else {
3737
await expect(summary).toBe('');
3838
}
@@ -133,6 +133,7 @@ suite('Params panel testing', () => {
133133
await forceAddParam('some param', '"pikachu"');
134134
await forceAddParam('some-param', '"bulbasaur"');
135135

136+
//TODO: see if we can remove this, maybe correcting some await in result display, or switching view manually
136137
await executeFile(workbench, 'params.cypher');
137138
await executeFile(workbench, 'params.cypher');
138139

@@ -153,7 +154,7 @@ suite('Params panel testing', () => {
153154
await escapeModal(4);
154155

155156
await checkResultsContent(workbench, true, async () => {
156-
await expectSummaries([
157+
await expectSummariesContain([
157158
'Expected parameter(s): a, b, some param, some-param',
158159
]);
159160
});
@@ -192,7 +193,6 @@ suite('Params panel testing', () => {
192193
await forceAddParam('some param', '"pikachu"');
193194
await forceAddParam('some-param', '"bulbasaur"');
194195

195-
await executeFile(workbench, 'params.cypher');
196196
await executeFile(workbench, 'params.cypher');
197197
await checkResultsContent(workbench, false, async () => {
198198
await expectTableContent([
@@ -224,7 +224,6 @@ suite('Params panel testing', () => {
224224
await forceAddParam('some param', '"pikachu"');
225225
await forceAddParam('some-param', '"bulbasaur"');
226226

227-
await executeFile(workbench, 'params.cypher');
228227
await executeFile(workbench, 'params.cypher');
229228

230229
await checkResultsContent(workbench, false, async () => {
@@ -248,7 +247,7 @@ suite('Params panel testing', () => {
248247
await escapeModal(2);
249248

250249
await checkResultsContent(workbench, true, async () => {
251-
await expectSummaries(['Expected parameter(s): a, b']);
250+
await expectSummariesContain(['Expected parameter(s): a, b']);
252251
});
253252
});
254253

packages/vscode-extension/tests/specs/webviews/queryExecution.spec.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ import {
1212

1313
//** Checks that the query result for each statement containts the expected summaries in query details.
1414
// If we pass an expected summary that is undefined we expect an empty result from query execution */
15-
export async function expectSummaries(
16-
expectedSummaries: (string | undefined)[],
15+
export async function expectSummariesContain(
16+
expectedSubstrings: (string | undefined)[],
1717
) {
1818
const queryDetails = await $$('#queryDetails .collapsible');
19-
await expect(queryDetails.length).toBe(expectedSummaries.length);
19+
await expect(queryDetails.length).toBe(expectedSubstrings.length);
2020

21-
for (let i = 0; i < expectedSummaries.length; i++) {
21+
for (let i = 0; i < expectedSubstrings.length; i++) {
2222
const queryDetail = (await $$('#queryDetails .collapsible'))[i];
2323
//This matches the expand/collapse button, but we only want to click when collapsed
2424
const expandButton = await queryDetail.$('button[aria-label*="statement"]');
@@ -30,8 +30,8 @@ export async function expectSummaries(
3030
const queryResult = await queryDetail.$('.collapsible-content');
3131
await queryResult.waitForDisplayed();
3232
const summary = await queryResult.getText();
33-
if (expectedSummaries[i] !== undefined) {
34-
await expect(summary).toContain(expectedSummaries[i]);
33+
if (expectedSubstrings[i] !== undefined) {
34+
await expect(summary).toContain(expectedSubstrings[i]);
3535
} else {
3636
await expect(summary).toBe('');
3737
}
@@ -50,7 +50,7 @@ suite('Query results testing', () => {
5050
test('should manage queries that need implicit transactions', async function () {
5151
await executeFile(workbench, 'call-in-transactions.cypher');
5252
await checkResultsContent(workbench, true, async () => {
53-
await expectSummaries([
53+
await expectSummariesContain([
5454
'6 nodes created, 12 properties set, 6 labels added.',
5555
]);
5656
});
@@ -59,14 +59,14 @@ suite('Query results testing', () => {
5959
test('should correctly execute valid Cypher', async function () {
6060
await executeFile(workbench, 'valid.cypher');
6161
await checkResultsContent(workbench, true, async () => {
62-
await expectSummaries(['1 nodes created, 1 labels added.']);
62+
await expectSummariesContain(['1 nodes created, 1 labels added.']);
6363
});
6464
});
6565

6666
test('should correctly execute valid Cypher when highlighting several statements', async function () {
6767
await executeFile(workbench, 'multiline.cypher');
6868
await checkResultsContent(workbench, true, async () => {
69-
await expectSummaries([
69+
await expectSummariesContain([
7070
'1 nodes created, 1 labels added.',
7171
'2 nodes created, 2 labels added.',
7272
'',
@@ -77,7 +77,7 @@ suite('Query results testing', () => {
7777
test('should error on invalid cypher', async function () {
7878
await executeFile(workbench, 'invalid.cypher');
7979
await checkResultsContent(workbench, true, async () => {
80-
await expectSummaries(['Variable `n` not defined']);
80+
await expectSummariesContain(['Variable `n` not defined']);
8181
});
8282
});
8383

@@ -91,11 +91,11 @@ suite('Query results testing', () => {
9191

9292
await executeFile(workbench, 'create-for-match.cypher');
9393
await checkResultsContent(workbench, true, async () => {
94-
await expectSummaries(['1 nodes created, 1 labels added.']);
94+
await expectSummariesContain(['1 nodes created, 1 labels added.']);
9595
});
9696
await executeFile(workbench, 'match-for-create.cypher');
9797
await checkResultsContent(workbench, true, async () => {
98-
await expectSummaries(['Started streaming 1 record']);
98+
await expectSummariesContain(['Started streaming 1 record']);
9999
});
100100

101101
// Disconnect from the current instance
@@ -105,7 +105,7 @@ suite('Query results testing', () => {
105105

106106
await executeFile(workbench, 'match-for-create.cypher');
107107
await checkResultsContent(workbench, true, async () => {
108-
await expectSummaries([undefined]);
108+
await expectSummariesContain([undefined]);
109109
});
110110
await clickOnContextMenuItem(connectionSection, 'Disconnect', 0);
111111

0 commit comments

Comments
 (0)