Skip to content

Commit

Permalink
test: change test
Browse files Browse the repository at this point in the history
  • Loading branch information
geekdada committed Apr 13, 2024
1 parent a18783e commit f97c258
Show file tree
Hide file tree
Showing 4 changed files with 175 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/provider/V2rayNSubscribeProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export const getV2rayNSubscription = async ({

export const parseJSONConfig = (
json: string,
isCompatibleMode: boolean | undefined,
isCompatibleMode?: boolean | undefined,
skipCertVerify?: boolean | undefined,
udpRelay?: boolean | undefined,
tls13?: boolean | undefined,
Expand Down
4 changes: 1 addition & 3 deletions src/provider/__tests__/ClashProvider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ test('ClashProvider', async (t) => {
})

t.is(provider.type, SupportProviderEnum.Clash)
await t.notThrowsAsync(async () => {
await provider.getNodeList()
})
t.snapshot(await provider.getNodeList())
})

test('ClashProvider new format', async (t) => {
Expand Down
173 changes: 173 additions & 0 deletions src/provider/__tests__/__snapshots__/ClashProvider.test.ts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
# Snapshot report for `src/provider/__tests__/ClashProvider.test.ts`

The actual snapshot is saved in `ClashProvider.test.ts.snap`.

Generated by [AVA](https://avajs.dev).

## ClashProvider

> Snapshot 1
[
{
hostname: 'server',
method: 'chacha20-ietf-poly1305',
nodeName: 'ss1',
password: 'password',
port: 443,
type: 'shadowsocks',
udpRelay: true,
},
{
hostname: 'server',
method: 'chacha20-ietf-poly1305',
nodeName: 'ss2',
obfs: 'tls',
obfsHost: 'www.bing.com',
password: 'password',
port: 443,
type: 'shadowsocks',
udpRelay: false,
},
{
hostname: 'server',
method: 'chacha20-ietf-poly1305',
nodeName: 'ss3',
obfs: 'ws',
obfsHost: 'server',
obfsUri: '/',
password: 'password',
port: 443,
type: 'shadowsocks',
udpRelay: false,
wsHeaders: {},
},
{
alterId: '32',
hostname: 'server',
method: 'auto',
network: 'tcp',
nodeName: 'vmess',
port: 443,
tls: false,
type: 'vmess',
udpRelay: false,
uuid: 'uuid',
},
{
alterId: '32',
hostname: 'server',
method: 'auto',
network: 'ws',
nodeName: 'vmess new format',
port: 443,
skipCertVerify: true,
tls: true,
tls13: false,
type: 'vmess',
udpRelay: true,
uuid: 'uuid',
wsOpts: {
'early-data-header-name': 'Sec-WebSocket-Protocol',
headers: {
Host: 'v2ray.com',
},
'max-early-data': 2048,
path: '/path',
},
},
{
alterId: '32',
hostname: 'server',
method: 'auto',
network: 'ws',
nodeName: 'vmess custom header',
port: 443,
skipCertVerify: false,
tls: true,
tls13: false,
type: 'vmess',
udpRelay: false,
uuid: 'uuid',
wsOpts: {
headers: {
edge: 'www.baidu.com',
},
path: '/path',
},
},
{
hostname: 'server',
nodeName: 'socks',
port: 443,
type: 'socks5',
},
{
hostname: 'server',
nodeName: 'http 1',
password: 'password',
port: 443,
skipCertVerify: false,
tls13: false,
type: 'https',
username: 'username',
},
{
hostname: 'server',
nodeName: 'http 2',
password: 'password',
port: 443,
type: 'http',
username: 'username',
},
{
hostname: 'server',
nodeName: 'snell',
obfs: 'http',
port: 44046,
psk: 'yourpsk',
type: 'snell',
},
{
hostname: 'server',
method: 'chacha20-ietf-poly1305',
nodeName: 'ss4',
obfs: 'tls',
obfsHost: 'example.com',
password: 'password',
port: 443,
type: 'shadowsocks',
udpRelay: false,
},
{
hostname: 'server',
method: 'chacha20-ietf-poly1305',
nodeName: 'ss-wss',
obfs: 'wss',
obfsHost: 'cloudflare.com',
obfsUri: '/ws',
password: 'password',
port: 443,
skipCertVerify: false,
tls13: false,
type: 'shadowsocks',
udpRelay: false,
wsHeaders: {},
},
{
alpn: [
'h3',
],
downloadBandwidth: 200,
hostname: 'server.com',
nodeName: 'hysteria2',
obfs: 'salamander',
obfsPassword: 'yourpassword',
password: 'yourpassword',
port: 443,
skipCertVerify: false,
sni: 'server.com',
type: 'hysteria2',
uploadBandwidth: 30,
},
]
Binary file not shown.

0 comments on commit f97c258

Please sign in to comment.