Skip to content

Commit

Permalink
Merge pull request #71 from vermaysha/test/environment-test
Browse files Browse the repository at this point in the history
Test case environment key
  • Loading branch information
vermaysha authored Jul 5, 2023
2 parents 993253e + 6a185b1 commit dbd3c93
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 82 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ jobs:
envkey_ACCOUNT_ID_V2: ${{ secrets.ACCOUNT_ID_V2 }}
envkey_ACCOUNT_MID_V2: ${{ secrets.ACCOUNT_MID_V2 }}
envkey_COOKIE_TOKEN_V2: ${{ secrets.COOKIE_TOKEN_V2 }}
envkey_HI_UID: ${{ secrets.HI_UID }}
envkey_GI_UID: ${{ secrets.GI_UID }}
envkey_HSR_UID: ${{ secrets.HSR_UID }}

- name: Lint
run: npm run lint
Expand Down
7 changes: 4 additions & 3 deletions tests/genshin_impact/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@ import { GenshinImpact, ICookie, LanguageEnum } from '../../src'
config()

export const cookie: ICookie = {
accountId: Number(process.env.ACCOUNT_ID),
accountId: parseInt(process.env.ACCOUNT_ID ?? '0'),
cookieToken: process.env.COOKIE_TOKEN,
ltoken: process.env.LTOKEN ?? '',
ltuid: Number(process.env.LTUID),
ltuid: parseInt(process.env.LTUID ?? '0'),
cookieTokenV2: process.env.COOKIE_TOKEN_V2 ?? '',
accountIdV2: Number(process.env.ACCOUNT_ID_V2),
accountIdV2: parseInt(process.env.ACCOUNT_ID_V2 ?? '0'),
accountMidV2: process.env.ACCOUNT_MID_V2,
}

export const genshin = async () => {
return await GenshinImpact.create({
cookie,
lang: LanguageEnum.ENGLISH,
uid: parseInt(process.env.GI_UID ?? '0'),
})
}
7 changes: 4 additions & 3 deletions tests/honkai_impact/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@ import { HonkaiImpact, ICookie, LanguageEnum } from '../../src'
config()

export const cookie: ICookie = {
accountId: Number(process.env.ACCOUNT_ID),
accountId: parseInt(process.env.ACCOUNT_ID ?? '0'),
cookieToken: process.env.COOKIE_TOKEN,
ltoken: process.env.LTOKEN ?? '',
ltuid: Number(process.env.LTUID),
ltuid: parseInt(process.env.LTUID ?? '0'),
cookieTokenV2: process.env.COOKIE_TOKEN_V2 ?? '',
accountIdV2: Number(process.env.ACCOUNT_ID_V2),
accountIdV2: parseInt(process.env.ACCOUNT_ID_V2 ?? '0'),
accountMidV2: process.env.ACCOUNT_MID_V2,
}

export const honkaiImpact = async () => {
return await HonkaiImpact.create({
cookie,
lang: LanguageEnum.ENGLISH,
uid: parseInt(process.env.HI_UID ?? '0'),
})
}
7 changes: 4 additions & 3 deletions tests/honkai_starrail/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@ import { HonkaiStarRail, ICookie, LanguageEnum } from '../../src'
config()

export const cookie: ICookie = {
accountId: Number(process.env.ACCOUNT_ID),
accountId: parseInt(process.env.ACCOUNT_ID ?? '0' ?? '0'),
cookieToken: process.env.COOKIE_TOKEN,
ltoken: process.env.LTOKEN ?? '',
ltuid: Number(process.env.LTUID),
ltuid: parseInt(process.env.LTUID ?? '0'),
cookieTokenV2: process.env.COOKIE_TOKEN_V2 ?? '',
accountIdV2: Number(process.env.ACCOUNT_ID_V2),
accountIdV2: parseInt(process.env.ACCOUNT_ID_V2 ?? '0'),
accountMidV2: process.env.ACCOUNT_MID_V2,
}

export const hsr = async () => {
return await HonkaiStarRail.create({
cookie,
lang: LanguageEnum.ENGLISH,
uid: parseInt(process.env.HSR_UID ?? '0'),
})
}
60 changes: 0 additions & 60 deletions tests/hoyolab/hoyolab.test.ts

This file was deleted.

13 changes: 0 additions & 13 deletions tests/hoyolab/setup.ts

This file was deleted.

0 comments on commit dbd3c93

Please sign in to comment.