Skip to content

Commit fc48563

Browse files
committed
fixed tests
1 parent e408c7d commit fc48563

File tree

10 files changed

+65
-141
lines changed

10 files changed

+65
-141
lines changed

package-lock.json

Lines changed: 17 additions & 114 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
"glob": "13.0.0",
109109
"jest": "30.2.0",
110110
"jest-cli": "30.2.0",
111-
"node-fetch": "3.3.2",
111+
"node-fetch": "2.7.0",
112112
"prettier": "3.7.4",
113113
"puppeteer": "24.34.0",
114114
"qs": "6.14.0",

test/e2e/scripts/browser.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import puppeteer, { Browser, EvaluateFn, Page } from 'puppeteer';
1+
import puppeteer, { Browser, EvaluateFunc, Page } from 'puppeteer';
22

33
let _browser: Browser;
44
let _page: Page;
@@ -8,8 +8,7 @@ const start = async () => {
88
// and load the localhost page, this page will load the
99
// javascript modules (see server.js for more info)
1010
_browser = await puppeteer.launch({
11-
headless: 'new',
12-
args: ['--no-sandbox', '--disable-setuid-sandbox'],
11+
headless: true,
1312
});
1413
_page = await _browser.newPage();
1514
// _page.on('console', msg => console.log(msg.text()));
@@ -19,15 +18,15 @@ const start = async () => {
1918
};
2019

2120
const stop = async () => {
22-
await _page.close();
23-
await _browser.close();
21+
await _page?.close();
22+
await _browser?.close();
2423
};
2524

26-
const evaluate = async (fn: EvaluateFn) => {
25+
const evaluate = async <T extends unknown[]>(fn: EvaluateFunc<T>) => {
2726
return await _page.evaluate(fn);
2827
};
2928

30-
// eslint-disable-next-line @typescript-eslint/ban-types
29+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
3130
const exposeFunction = async (name: string, fn: Function) => {
3231
return await _page.exposeFunction(name, fn);
3332
};

test/e2e/scripts/createAngularProject.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const createAngularProject = (dir: string, name: string) => {
88
recursive: true,
99
});
1010

11-
sync('ng', ['analytics', 'off', '--global'], {
11+
sync('ng', ['analytics', 'disable', '--global'], {
1212
cwd: resolvePath(cwd),
1313
stdio: 'inherit',
1414
});
@@ -18,6 +18,8 @@ export const createAngularProject = (dir: string, name: string) => {
1818
[
1919
'new',
2020
name,
21+
'--ai-config',
22+
'none',
2123
'--minimal',
2224
'true',
2325
'--style',

test/e2e/scripts/server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ const start = async (dir: string) => {
6565
// Register an 'echo' server that just returns all data from the API calls.
6666
// Although this might not be a 'correct' response, we can use this to test
6767
// the majority of API calls.
68-
_app.all('/base/api/v1.0/*', (req, res) => {
68+
_app.all('/base/api/v1.0/*path', (req, res) => {
6969
setTimeout(() => {
7070
res.json({
7171
method: req.method,
@@ -87,7 +87,7 @@ const start = async (dir: string) => {
8787

8888
const stop = async () => {
8989
return new Promise<void>((resolve, reject) => {
90-
_server.close(err => {
90+
_server?.close(err => {
9191
if (err) {
9292
reject(err);
9393
} else {

test/e2e/v3.axios.spec.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ describe('v3.axios', () => {
5757
'valuePath',
5858
{
5959
prop: 'valueBody',
60-
}
60+
},
6161
);
6262
expect(result).toBeDefined();
6363
});
@@ -104,7 +104,7 @@ describe('v3.axios', () => {
104104
status: 500,
105105
message: 'hello world',
106106
},
107-
})
107+
}),
108108
);
109109
});
110110

@@ -136,7 +136,7 @@ describe('v3.axios', () => {
136136
status: 409,
137137
message: 'hello world',
138138
},
139-
})
139+
}),
140140
);
141141
});
142142

@@ -147,6 +147,10 @@ describe('v3.axios', () => {
147147
size: 1,
148148
sort: ['location'],
149149
})) as Promise<any>;
150-
expect((result as any).query).toStrictEqual({ parameter: { page: '0', size: '1', sort: 'location' } });
150+
expect((result as any).query).toStrictEqual({
151+
'parameter[page]': '0',
152+
'parameter[size]': '1',
153+
'parameter[sort]': 'location',
154+
});
151155
});
152156
});

test/e2e/v3.babel.spec.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ describe('v3.babel', () => {
126126
status: 500,
127127
message: 'hello world',
128128
},
129-
})
129+
}),
130130
);
131131
});
132132

@@ -162,7 +162,7 @@ describe('v3.babel', () => {
162162
status: 409,
163163
message: 'hello world',
164164
},
165-
})
165+
}),
166166
);
167167
});
168168

@@ -177,6 +177,10 @@ describe('v3.babel', () => {
177177
},
178178
})) as Promise<any>;
179179
});
180-
expect(result.query).toStrictEqual({ parameter: { page: '0', size: '1', sort: 'location' } });
180+
expect(result.query).toStrictEqual({
181+
'parameter[page]': '0',
182+
'parameter[size]': '1',
183+
'parameter[sort]': 'location',
184+
});
181185
});
182186
});

test/e2e/v3.fetch.spec.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ describe('v3.fetch', () => {
6969
'valuePath',
7070
{
7171
prop: 'valueBody',
72-
}
72+
},
7373
);
7474
});
7575
expect(result).toBeDefined();
@@ -122,7 +122,7 @@ describe('v3.fetch', () => {
122122
status: 500,
123123
message: 'hello world',
124124
},
125-
})
125+
}),
126126
);
127127
});
128128

@@ -156,7 +156,7 @@ describe('v3.fetch', () => {
156156
status: 409,
157157
message: 'hello world',
158158
},
159-
})
159+
}),
160160
);
161161
});
162162

@@ -169,6 +169,10 @@ describe('v3.fetch', () => {
169169
sort: ['location'],
170170
})) as Promise<any>;
171171
});
172-
expect(result.query).toStrictEqual({ parameter: { page: '0', size: '1', sort: 'location' } });
172+
expect(result.query).toStrictEqual({
173+
'parameter[page]': '0',
174+
'parameter[size]': '1',
175+
'parameter[sort]': 'location',
176+
});
173177
});
174178
});

0 commit comments

Comments
 (0)