Remove legacy Summoner fields
This commit is contained in:
1 parent
38cb97d86a
commit
bc36a8f0f0
3 files changed
+2
-13
No files matched your search
@@ -197,7 +197,6 @@ function createPipelineHarness(options: PipelineHarnessOptions = {}) {
|
||||
const riotApiClient = {
|
||||
getAccountByRiotId,
|
||||
getSummonerByPuuid: jest.fn().mockResolvedValue({
|
||||
id: 'summoner-id',
|
||||
puuid: 'target-puuid',
|
||||
profileIconId: 1,
|
||||
summonerLevel: 500,
|
||||
|
||||
@@ -91,9 +91,8 @@ describe('RiotApiClient', () => {
|
||||
const fetchMock = createFetchMock()
|
||||
.mockResolvedValueOnce(
|
||||
jsonResponse({
|
||||
id: 'summoner-1',
|
||||
puuid: 'puuid/1',
|
||||
profileIconId: 7,
|
||||
puuid: 'puuid/1',
|
||||
summonerLevel: 30,
|
||||
}),
|
||||
)
|
||||
@@ -122,7 +121,7 @@ describe('RiotApiClient', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('accepts current Summoner-V4 by-puuid responses without legacy id fields', async () => {
|
||||
it('accepts current Summoner-V4 by-puuid responses', async () => {
|
||||
const fetchMock = createFetchMock().mockResolvedValue(
|
||||
jsonResponse({
|
||||
profileIconId: 7,
|
||||
|
||||
@@ -28,8 +28,6 @@ export interface RiotAccountDto {
|
||||
}
|
||||
|
||||
export interface RiotSummonerDto {
|
||||
accountId?: string;
|
||||
id?: string;
|
||||
profileIconId: number;
|
||||
puuid: string;
|
||||
revisionDate?: number;
|
||||
@@ -182,11 +180,6 @@ function requireString(
|
||||
return value;
|
||||
}
|
||||
|
||||
function optionalString(record: Record<string, unknown>, key: string) {
|
||||
const value = record[key];
|
||||
return typeof value === 'string' ? value : undefined;
|
||||
}
|
||||
|
||||
function numberOrFallback(
|
||||
record: Record<string, unknown>,
|
||||
key: string,
|
||||
@@ -404,8 +397,6 @@ export class RiotApiClient {
|
||||
private parseSummoner(value: unknown): RiotSummonerDto {
|
||||
const record = requireRecord(value, 'summoner');
|
||||
return {
|
||||
id: optionalString(record, 'id'),
|
||||
accountId: optionalString(record, 'accountId'),
|
||||
puuid: requireString(record, 'puuid', 'summoner'),
|
||||
profileIconId: numberOrFallback(record, 'profileIconId', 0),
|
||||
revisionDate: optionalNumber(record, 'revisionDate'),
|
||||
|
||||
Reference in new issue
Block a user