Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0616df3

Browse files
authored
tests: add gist card performance test (anuraghazra#3372)
1 parent7595456 commit0616df3

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

‎tests/bench/gist.bench.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import{benchmarkSuite}from"jest-bench";
2+
importgistfrom"../../api/gist.js";
3+
importaxiosfrom"axios";
4+
importMockAdapterfrom"axios-mock-adapter";
5+
import{jest}from"@jest/globals";
6+
7+
constgist_data={
8+
data:{
9+
viewer:{
10+
gist:{
11+
description:
12+
"List of countries and territories in English and Spanish: name, continent, capital, dial code, country codes, TLD, and area in sq km. Lista de países y territorios en Inglés y Español: nombre, continente, capital, código de teléfono, códigos de país, dominio y área en km cuadrados. Updated 2023",
13+
owner:{
14+
login:"Yizack",
15+
},
16+
stargazerCount:33,
17+
forks:{
18+
totalCount:11,
19+
},
20+
files:[
21+
{
22+
name:"countries.json",
23+
language:{
24+
name:"JSON",
25+
},
26+
size:85858,
27+
},
28+
],
29+
},
30+
},
31+
},
32+
};
33+
34+
constmock=newMockAdapter(axios);
35+
mock.onPost("https://api.github.com/graphql").reply(200,gist_data);
36+
37+
benchmarkSuite("test /api/gist",{
38+
["simple request"]:async()=>{
39+
constreq={
40+
query:{
41+
id:"bbfce31e0217a3689c8d961a356cb10d",
42+
},
43+
};
44+
constres={
45+
setHeader:jest.fn(),
46+
send:jest.fn(),
47+
};
48+
49+
awaitgist(req,res);
50+
},
51+
});

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp