Skip to content
This repository has been archived by the owner on Mar 23, 2022. It is now read-only.

Commit

Permalink
Merge pull request #28 from RaenonX-DL/dev
Browse files Browse the repository at this point in the history
v2.15.0-beta.3 Release
  • Loading branch information
RaenonX authored Oct 2, 2021
2 parents 52b6fd2 + 76055bb commit 1ce8daa
Show file tree
Hide file tree
Showing 18 changed files with 17 additions and 76 deletions.
2 changes: 1 addition & 1 deletion src/api-def
4 changes: 0 additions & 4 deletions src/endpoints/info/lookup/controller.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ describe('Unit info lookup controller', () => {
}],
tipsBuilds: 'tips',
videos: 'video',
story: 'story',
keywords: 'keyword',
};

const payloadDragon: DragonAnalysisPublishPayload = {
Expand All @@ -47,8 +45,6 @@ describe('Unit info lookup controller', () => {
notes: 'dragonNotes',
suitableCharacters: 'dragonChara',
videos: 'dragonVideo',
story: 'dragonStory',
keywords: 'dragonKeyword',
};

const insert3Chara = async () => {
Expand Down
2 changes: 1 addition & 1 deletion src/endpoints/info/lookup/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class UnitInfoLookupController {
* @return {Promise<Array<UnitInfoLookupEntry>>} list of most recently modified analyses
*/
static async getRecentlyModifiedAnalyses(
mongoClient: MongoClient, lang: SupportedLanguages, maxCount = 3,
mongoClient: MongoClient, lang: SupportedLanguages, maxCount = 9,
): Promise<Array<UnitInfoLookupEntry>> {
return UnitInfoLookupController.getAnalysisInfo(mongoClient, lang, (cursor) => {
return cursor
Expand Down
13 changes: 9 additions & 4 deletions src/endpoints/info/lookup/landing/handler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ describe(`[Server] GET ${ApiEndPoints.INFO_UNIT_LOOKUP_LANDING} - analysis looku
}],
tipsBuilds: 'tips',
videos: 'video',
story: 'story',
keywords: 'keyword',
};

const payloadLookup: UnitInfoLookupLandingPayload = {
Expand Down Expand Up @@ -69,7 +67,12 @@ describe(`[Server] GET ${ApiEndPoints.INFO_UNIT_LOOKUP_LANDING} - analysis looku
.toStrictEqual([10950101, 10950201]);
});

it('returns at most 3 analyses', async () => {
it('returns at most 9 analyses', async () => {
await AnalysisController.publishCharaAnalysis(app.mongoClient, {...payloadPost, unitId: 10530401});
await AnalysisController.publishCharaAnalysis(app.mongoClient, {...payloadPost, unitId: 10530501});
await AnalysisController.publishCharaAnalysis(app.mongoClient, {...payloadPost, unitId: 10540102});
await AnalysisController.publishCharaAnalysis(app.mongoClient, {...payloadPost, unitId: 10540103});
await AnalysisController.publishCharaAnalysis(app.mongoClient, {...payloadPost, unitId: 10540201});
await AnalysisController.publishCharaAnalysis(app.mongoClient, {...payloadPost, unitId: 10540401});
await AnalysisController.publishCharaAnalysis(app.mongoClient, {...payloadPost, unitId: 10850401});
await AnalysisController.publishCharaAnalysis(app.mongoClient, {...payloadPost, unitId: 10850302});
Expand All @@ -83,7 +86,9 @@ describe(`[Server] GET ${ApiEndPoints.INFO_UNIT_LOOKUP_LANDING} - analysis looku
expect(json.code).toBe(ApiResponseCode.SUCCESS);
expect(json.success).toBe(true);
expect(Object.values(json.analyses).map((entry) => entry.unitId))
.toStrictEqual([10950101, 10950201, 10850302]);
.toStrictEqual([
10950101, 10950201, 10850302, 10850401, 10540401, 10540201, 10540103, 10540102, 10530501,
]);
});

it('returns an empty result if no analyses exist yet', async () => {
Expand Down
2 changes: 0 additions & 2 deletions src/endpoints/info/lookup/main/handler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ describe(`[Server] GET ${ApiEndPoints.INFO_UNIT_LOOKUP} - unit info lookup`, ()
}],
tipsBuilds: 'tips',
videos: 'video',
story: 'story',
keywords: 'keyword',
};

const payloadList1: UnitInfoLookupPayload = {
Expand Down
4 changes: 0 additions & 4 deletions src/endpoints/meta/post/handler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ describe('Post meta EP', () => {
}],
tipsBuilds: 'tip1',
videos: 'video1',
story: 'story1',
keywords: 'kw1',
};

beforeEach(async () => {
Expand Down Expand Up @@ -191,8 +189,6 @@ describe('Post meta EP', () => {
}],
tipsBuilds: 'tip1',
videos: 'video1',
story: 'story1',
keywords: 'kw1',
};

beforeEach(async () => {
Expand Down
2 changes: 0 additions & 2 deletions src/endpoints/post/analysis/character/edit/handler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ describe(`[Server] POST ${ApiEndPoints.POST_ANALYSIS_EDIT_CHARA} - edit a charac
}],
tipsBuilds: 'tip1',
videos: 'video1',
story: 'story1',
keywords: 'kw1',
};

const payloadEdit: CharaAnalysisEditPayload = {
Expand Down
6 changes: 0 additions & 6 deletions src/endpoints/post/analysis/character/publish/handler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ describe(`[Server] POST ${ApiEndPoints.POST_ANALYSIS_PUBLISH_CHARA} - publish ch
}],
tipsBuilds: 'tip1',
videos: 'video1',
story: 'story1',
keywords: 'kw1',
};

const payload2: CharaAnalysisPublishPayload = {
Expand Down Expand Up @@ -168,8 +166,6 @@ describe(`[Server] POST ${ApiEndPoints.POST_ANALYSIS_PUBLISH_CHARA} - publish ch
));
expect(doc.tipsBuilds).toEqual(payload2.tipsBuilds);
expect(doc.videos).toEqual(payload2.videos);
expect(doc.story).toEqual(payload2.story);
expect(doc.keywords).toEqual(payload2.keywords);
expect(doc.datePublishedEpoch.valueOf() - Date.now()).toBeLessThanOrEqual(1000);
expect(doc.dateModifiedEpoch.valueOf() - Date.now()).toBeLessThanOrEqual(1000);
expect(doc.editNotes).toHaveLength(0);
Expand Down Expand Up @@ -201,8 +197,6 @@ describe(`[Server] POST ${ApiEndPoints.POST_ANALYSIS_PUBLISH_CHARA} - publish ch
));
expect(doc.tipsBuilds).toEqual(payload2.tipsBuilds);
expect(doc.videos).toEqual(payload2.videos);
expect(doc.story).toEqual(payload2.story);
expect(doc.keywords).toEqual(payload2.keywords);
expect(doc.datePublishedEpoch.valueOf() - Date.now()).toBeLessThanOrEqual(1000);
expect(doc.dateModifiedEpoch.valueOf() - Date.now()).toBeLessThanOrEqual(1000);
expect(doc.editNotes).toHaveLength(0);
Expand Down
12 changes: 2 additions & 10 deletions src/endpoints/post/analysis/controller.character.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ describe(`[Controller] ${AnalysisController.name} (Character)`, () => {
}],
tipsBuilds: 'tips',
videos: 'video',
story: 'story',
keywords: 'keyword',
};

beforeAll(async () => {
Expand Down Expand Up @@ -74,8 +72,6 @@ describe(`[Controller] ${AnalysisController.name} (Character)`, () => {
]);
expect(post.tipsBuilds).toBe('tips');
expect(post.videos).toBe('video');
expect(post.story).toBe('story');
expect(post.keywords).toBe('keyword');
// Weird syntax on checking the value is number - https://stackoverflow.com/a/56133391/11571888
expect(post.datePublishedEpoch).toEqual(expect.any(Number));
expect(post.dateModifiedEpoch).toEqual(expect.any(Number));
Expand All @@ -89,7 +85,7 @@ describe(`[Controller] ${AnalysisController.name} (Character)`, () => {
await AnalysisController.publishCharaAnalysis(app.mongoClient, {
...payloadChara,
lang: SupportedLanguages.EN,
keywords: 'kw-en',
passives: 'passive-en',
});

const postDoc = await CharaAnalysis.getCollection(app.mongoClient).findOne({
Expand All @@ -102,7 +98,7 @@ describe(`[Controller] ${AnalysisController.name} (Character)`, () => {
expect(post.unitId).toBe(10950101);
expect(post.summary).toBe('summary');
expect(post.summonResult).toBe('summon');
expect(post.passives).toBe('passive');
expect(post.passives).toBe('passive-en');
expect(post.normalAttacks).toBe('normal');
expect(post.forceStrike).toBe('force');
expect(post.skills.map((info) => info.toObject())).toStrictEqual([
Expand All @@ -115,8 +111,6 @@ describe(`[Controller] ${AnalysisController.name} (Character)`, () => {
]);
expect(post.tipsBuilds).toBe('tips');
expect(post.videos).toBe('video');
expect(post.story).toBe('story');
expect(post.keywords).toBe('kw-en');
});

it('publishes analyses in different languages and IDs', async () => {
Expand Down Expand Up @@ -183,8 +177,6 @@ describe(`[Controller] ${AnalysisController.name} (Character)`, () => {
]);
expect(post.tipsBuilds).toBe('tips');
expect(post.videos).toBe('video');
expect(post.story).toBe('story');
expect(post.keywords).toBe('keyword');
});

it('blocks publishing with non-existent unit ID', async () => {
Expand Down
12 changes: 2 additions & 10 deletions src/endpoints/post/analysis/controller.dragon.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ describe(`[Controller] ${AnalysisController.name} (Dragon)`, () => {
notes: 'dragonNotes',
suitableCharacters: 'dragonChara',
videos: 'dragonVideo',
story: 'dragonStory',
keywords: 'dragonKeyword',
};

beforeAll(async () => {
Expand Down Expand Up @@ -61,8 +59,6 @@ describe(`[Controller] ${AnalysisController.name} (Dragon)`, () => {
expect(post.notes).toBe('dragonNotes');
expect(post.suitableCharacters).toBe('dragonChara');
expect(post.videos).toBe('dragonVideo');
expect(post.story).toBe('dragonStory');
expect(post.keywords).toBe('dragonKeyword');
// Weird syntax on checking the value is number - https://stackoverflow.com/a/56133391/11571888
expect(post.datePublishedEpoch).toEqual(expect.any(Number));
expect(post.dateModifiedEpoch).toEqual(expect.any(Number));
Expand All @@ -77,7 +73,7 @@ describe(`[Controller] ${AnalysisController.name} (Dragon)`, () => {
...payloadDragon,
unitId: payloadDragon.unitId,
lang: SupportedLanguages.EN,
keywords: 'kw-en',
passives: 'passive-en',
});

const postDoc = await DragonAnalysis.getCollection(app.mongoClient).findOne({
Expand All @@ -90,14 +86,12 @@ describe(`[Controller] ${AnalysisController.name} (Dragon)`, () => {
expect(post.unitId).toBe(20040405);
expect(post.summary).toBe('dragonSummary');
expect(post.summonResult).toBe('dragonSummon');
expect(post.passives).toBe('dragonPassive');
expect(post.passives).toBe('passive-en');
expect(post.normalAttacks).toBe('dragonNormal');
expect(post.ultimate).toBe('dragonUltimate');
expect(post.notes).toBe('dragonNotes');
expect(post.suitableCharacters).toBe('dragonChara');
expect(post.videos).toBe('dragonVideo');
expect(post.story).toBe('dragonStory');
expect(post.keywords).toBe('kw-en');
});

it('blocks publishing duplicated analysis and the content is unchanged', async () => {
Expand Down Expand Up @@ -125,8 +119,6 @@ describe(`[Controller] ${AnalysisController.name} (Dragon)`, () => {
expect(post.notes).toBe('dragonNotes');
expect(post.suitableCharacters).toBe('dragonChara');
expect(post.videos).toBe('dragonVideo');
expect(post.story).toBe('dragonStory');
expect(post.keywords).toBe('dragonKeyword');
});

it('blocks publishing analysis with non-existent unit ID', async () => {
Expand Down
2 changes: 0 additions & 2 deletions src/endpoints/post/analysis/controller.shared.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ describe(`[Controller] ${AnalysisController.name} (Shared / Read)`, () => {
}],
tipsBuilds: 'tips',
videos: 'video',
story: 'story',
keywords: 'keyword',
};

beforeAll(async () => {
Expand Down
2 changes: 0 additions & 2 deletions src/endpoints/post/analysis/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ class AnalysisGetResult extends PostGetResult<AnalysisDocument> {
passives: this.post[UnitAnalysisDocumentKey.passives],
normalAttacks: this.post[UnitAnalysisDocumentKey.normalAttacks],
videos: this.post[UnitAnalysisDocumentKey.videos],
story: this.post[UnitAnalysisDocumentKey.story],
keywords: this.post[UnitAnalysisDocumentKey.keywords],
};

if (base.type === UnitType.CHARACTER) {
Expand Down
2 changes: 0 additions & 2 deletions src/endpoints/post/analysis/dragon/edit/handler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ describe(`[Server] POST ${ApiEndPoints.POST_ANALYSIS_EDIT_DRAGON} - edit a drago
notes: 'dragonNotes',
suitableCharacters: 'dragonChara',
videos: 'dragonVideo',
story: 'dragonStory',
keywords: 'dragonKeyword',
};

const payloadEdit: DragonAnalysisEditPayload = {
Expand Down
6 changes: 0 additions & 6 deletions src/endpoints/post/analysis/dragon/publish/handler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ describe(`[Server] POST ${ApiEndPoints.POST_ANALYSIS_PUBLISH_DRAGON} - publish d
notes: 'dragonNotes',
suitableCharacters: 'dragonChara',
videos: 'dragonVideo',
story: 'dragonStory',
keywords: 'dragonKeyword',
};

const payload2: DragonAnalysisPublishPayload = {
Expand Down Expand Up @@ -159,8 +157,6 @@ describe(`[Server] POST ${ApiEndPoints.POST_ANALYSIS_PUBLISH_DRAGON} - publish d
expect(doc.ultimate).toEqual(payload2.ultimate);
expect(doc.notes).toEqual(payload2.notes);
expect(doc.videos).toEqual(payload2.videos);
expect(doc.story).toEqual(payload2.story);
expect(doc.keywords).toEqual(payload2.keywords);
expect(doc.datePublishedEpoch.valueOf() - Date.now()).toBeLessThanOrEqual(1000);
expect(doc.dateModifiedEpoch.valueOf() - Date.now()).toBeLessThanOrEqual(1000);
expect(doc.editNotes).toHaveLength(0);
Expand Down Expand Up @@ -188,8 +184,6 @@ describe(`[Server] POST ${ApiEndPoints.POST_ANALYSIS_PUBLISH_DRAGON} - publish d
expect(doc.ultimate).toEqual(payload2.ultimate);
expect(doc.notes).toEqual(payload2.notes);
expect(doc.videos).toEqual(payload2.videos);
expect(doc.story).toEqual(payload2.story);
expect(doc.keywords).toEqual(payload2.keywords);
expect(doc.datePublishedEpoch.valueOf() - Date.now()).toBeLessThanOrEqual(1000);
expect(doc.dateModifiedEpoch.valueOf() - Date.now()).toBeLessThanOrEqual(1000);
expect(doc.editNotes).toHaveLength(0);
Expand Down
16 changes: 1 addition & 15 deletions src/endpoints/post/analysis/model/unitAnalysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ export enum UnitAnalysisDocumentKey {
passives = 'p',
normalAttacks = 'na',
videos = 'v',
story = 'st',
keywords = 'k',
}

export type UnitAnalysisDocument = PostDocumentBaseNoTitle & {
Expand All @@ -26,8 +24,6 @@ export type UnitAnalysisDocument = PostDocumentBaseNoTitle & {
[UnitAnalysisDocumentKey.passives]: string,
[UnitAnalysisDocumentKey.normalAttacks]: string,
[UnitAnalysisDocumentKey.videos]: string,
[UnitAnalysisDocumentKey.story]: string,
[UnitAnalysisDocumentKey.keywords]: string,
}

export type UnitAnalysisConstructParams = PostConstructParamsNoTitle & {
Expand All @@ -38,8 +34,6 @@ export type UnitAnalysisConstructParams = PostConstructParamsNoTitle & {
passives: string,
normalAttacks: string,
videos: string,
story: string,
keywords: string,
}

/**
Expand All @@ -53,8 +47,6 @@ export abstract class UnitAnalysis extends PostNoTitle {
passives: string;
normalAttacks: string;
videos: string;
story: string;
keywords: string;

/**
* Construct a unit analysis data.
Expand All @@ -64,7 +56,7 @@ export abstract class UnitAnalysis extends PostNoTitle {
protected constructor(params: UnitAnalysisConstructParams) {
super(params);

const {type, unitId, summary, summonResult, passives, normalAttacks, videos, story, keywords} = params;
const {type, unitId, summary, summonResult, passives, normalAttacks, videos} = params;

this.type = type;
this.unitId = unitId;
Expand All @@ -73,8 +65,6 @@ export abstract class UnitAnalysis extends PostNoTitle {
this.passives = passives;
this.normalAttacks = normalAttacks;
this.videos = videos;
this.story = story;
this.keywords = keywords;
}

/**
Expand Down Expand Up @@ -113,8 +103,6 @@ export abstract class UnitAnalysis extends PostNoTitle {
passives: obj[UnitAnalysisDocumentKey.passives],
normalAttacks: obj[UnitAnalysisDocumentKey.normalAttacks],
videos: obj[UnitAnalysisDocumentKey.videos],
story: obj[UnitAnalysisDocumentKey.story],
keywords: obj[UnitAnalysisDocumentKey.keywords],
editNotes: obj[EditableDocumentKey.editNotes].map((editNote) => EditNote.fromDocument(editNote)),
};
}
Expand Down Expand Up @@ -147,8 +135,6 @@ export abstract class UnitAnalysis extends PostNoTitle {
[UnitAnalysisDocumentKey.passives]: this.passives,
[UnitAnalysisDocumentKey.normalAttacks]: this.normalAttacks,
[UnitAnalysisDocumentKey.videos]: this.videos,
[UnitAnalysisDocumentKey.story]: this.story,
[UnitAnalysisDocumentKey.keywords]: this.keywords,
};
}
}
2 changes: 0 additions & 2 deletions src/endpoints/post/analysis/shared/get/handler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ describe(`[Server] GET ${ApiEndPoints.POST_ANALYSIS_GET} - get analysis`, () =>
}],
tipsBuilds: 'tips',
videos: 'video',
story: 'story',
keywords: 'keyword',
};

beforeAll(async () => {
Expand Down
2 changes: 0 additions & 2 deletions src/endpoints/post/analysis/shared/idCheck/handler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ describe(`[Server] GET ${ApiEndPoints.POST_ANALYSIS_ID_CHECK} - check analysis I
}],
tipsBuilds: 'tips',
videos: 'video',
story: 'story',
keywords: 'keyword',
};

beforeAll(async () => {
Expand Down
2 changes: 1 addition & 1 deletion test/data/resources
Submodule resources updated 759 files

0 comments on commit 1ce8daa

Please sign in to comment.