Cleaning
This commit is contained in:
parent
8b38f7bc1f
commit
ba60669391
|
@ -5,7 +5,7 @@ import GelbooruApiService from "./GelbooruApiService";
|
|||
|
||||
class ImageService {
|
||||
postsQueue: Image[] = [];
|
||||
|
||||
|
||||
async get(): Promise<Image> {
|
||||
while (this.postsQueue.length === 0) {
|
||||
const validPosts = await this.getNewValidImages();
|
||||
|
@ -13,6 +13,7 @@ class ImageService {
|
|||
}
|
||||
return this.postsQueue.pop() as Image;
|
||||
}
|
||||
|
||||
private async getNewValidImages(): Promise<Image[]> {
|
||||
const gelbooruResponse: GelbooruServiceResponse = await GelbooruApiService.get();
|
||||
const posts = gelbooruResponse.posts;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { afterEach, beforeAll, describe, expect, it, mock } from "bun:test";
|
||||
import { describe, expect, it, mock } from "bun:test";
|
||||
import Image from "../src/types/Image"
|
||||
import ImageService from "../src/services/ImageService";
|
||||
import GelbooruApiResponse from "../src/types/GelbooruServiceResponse";
|
||||
|
|
Loading…
Reference in New Issue