Skip to content

Commit

Permalink
Merge 5126170 into 282c780
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancescoBorzi committed Apr 8, 2020
2 parents 282c780 + 5126170 commit 42318bb
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/app/shared/services/mysql-query.service.spec.ts
Expand Up @@ -898,6 +898,24 @@ describe('MysqlQueryService', () => {
);
});

it('getPrevQuestById', async () => {
expect(await service.getPrevQuestById(id)).toEqual(result);
expect(await service.getPrevQuestById(id)).toEqual(result); // check cache
expect(service.queryValue).toHaveBeenCalledTimes(1); // check cache
expect(service.queryValue).toHaveBeenCalledWith(
`SELECT PrevQuestID AS v FROM quest_template_addon WHERE id = ${id}`,
);
});

it('getNextQuestById', async () => {
expect(await service.getNextQuestById(id)).toEqual(result);
expect(await service.getNextQuestById(id)).toEqual(result); // check cache
expect(service.queryValue).toHaveBeenCalledTimes(1); // check cache
expect(service.queryValue).toHaveBeenCalledWith(
`SELECT NextQuestID AS v FROM quest_template_addon WHERE id = ${id}`,
);
});

it('getQuestTitleByCriteria (case 2)', () => {
expect(service.getQuestTitleByCriteria(1, null, null, null)).toEqual(resultToPromise);
expect(service.queryValueToPromise).toHaveBeenCalledWith(
Expand Down
8 changes: 8 additions & 0 deletions src/app/shared/services/mysql-query.service.ts
Expand Up @@ -372,6 +372,14 @@ export class MysqlQueryService extends QueryService {
return this.queryValueToPromiseCached('getQuestTitleById', String(id), `SELECT LogTitle AS v FROM quest_template WHERE ID = ${id}`);
}

getPrevQuestById(id: string|number): Promise<string> {
return this.queryValueToPromiseCached('getPrevQuestById', String(id), `SELECT PrevQuestID AS v FROM quest_template_addon WHERE id = ${id}`);
}

getNextQuestById(id: string|number): Promise<string> {
return this.queryValueToPromiseCached('getNextQuestById', String(id), `SELECT NextQuestID AS v FROM quest_template_addon WHERE id = ${id}`);
}

getItemNameById(id: string|number): Promise<string> {
return this.queryValueToPromiseCached('getItemNameById', String(id), `SELECT name AS v FROM item_template WHERE entry = ${id}`);
}
Expand Down

0 comments on commit 42318bb

Please sign in to comment.