From e8b1cb570aa8946bb99f789d9b01932cba0921e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D1=80=D0=BE=D0=BD=D0=B8=D0=BD=20=D0=95=D0=B3=D0=BE?= =?UTF-8?q?=D1=80?= Date: Fri, 5 Mar 2021 22:36:14 +1000 Subject: [PATCH] =?UTF-8?q?=D0=92=D1=8B=D0=BD=D0=BE=D1=81=20=D1=84=D1=83?= =?UTF-8?q?=D0=BD=D0=BA=D1=86=D0=B8=D0=B8=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5?= =?UTF-8?q?=D1=80=D0=BA=D0=B8=20=D1=81=D0=B1=D0=BE=D1=80=D1=89=D0=B8=D0=BA?= =?UTF-8?q?=D0=B0=20=D0=B2=20=D1=81=D1=82=D0=B0=D1=82=D0=B8=D1=87=D0=B5?= =?UTF-8?q?=D1=81=D0=BA=D0=B8=D0=B9=20=D0=BC=D0=B5=D1=82=D0=BE=D0=B4=20(Cl?= =?UTF-8?q?oses=20#53)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 2 +- package.json | 2 +- src/PagesManager.ts | 9 ++++++++- src/functions.ts | 9 --------- test/tests.mjs | 18 ++++++++---------- 5 files changed, 18 insertions(+), 22 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0cc0958..51cff3e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "vk-io-pages", - "version": "1.5.2", + "version": "1.5.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 6da662b..1095eb7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vk-io-pages", - "version": "1.5.2", + "version": "1.5.3", "description": "Модуль vk-io для создания динамических страниц", "scripts": { "tsc": "tsc && node --experimental-modules --es-module-specifier-resolution=node ./scripts/removeEmptyFiles.mjs", diff --git a/src/PagesManager.ts b/src/PagesManager.ts index 9b0c817..684a2c6 100644 --- a/src/PagesManager.ts +++ b/src/PagesManager.ts @@ -41,6 +41,14 @@ export class PagesManager { } } + /** + * Функция для проверки наличия сборщика + */ + static hasBuilder(builderId: string): boolean { + return pagesStorage.has(builderId); + } + + /** * Метод для установки обработчика при отсутствии сборщика */ @@ -51,7 +59,6 @@ export class PagesManager { } } -export { hasBuilder } from "./functions"; export { PagesBuilder, pagesStorage diff --git a/src/functions.ts b/src/functions.ts index 9697396..a26992a 100644 --- a/src/functions.ts +++ b/src/functions.ts @@ -1,5 +1,3 @@ -import { pagesStorage } from "./PagesBuilder"; - export function randomString(length: number): string { const characters = "abcdefghijklmnopqrstuvwxyz"; @@ -11,10 +9,3 @@ export function randomString(length: number): string { return string; } - -/** - * Функция для проверки наличия сборщика - */ -export function hasBuilder(builderId: string): boolean { - return pagesStorage.has(builderId); -} diff --git a/test/tests.mjs b/test/tests.mjs index cb6c26c..cc282dd 100644 --- a/test/tests.mjs +++ b/test/tests.mjs @@ -1,7 +1,7 @@ import assert from "assert"; import VKIO from "vk-io"; -import { PagesBuilder, pagesStorage } from "../esm/index.mjs"; +import { PagesBuilder, PagesManager } from "../esm/index.mjs"; const { VK, getRandomId, Keyboard } = VKIO; @@ -67,17 +67,15 @@ describe("Pages", () => { builder.addPages("Test"); builder.addPages(pages); - await assert.doesNotReject(async () => { - await builder.build(); + await builder.build(); - builder.sentContext = createContext(); + builder.sentContext = createContext(); - for (let i = 2; i <= builder.pages.length; i++) { - await builder.setPage(i); + for (let i = 2; i <= builder.pages.length; i++) { + await builder.setPage(i); - builder.sentContext = createContext(); - } - }); + builder.sentContext = createContext(); + } }); } @@ -121,7 +119,7 @@ describe("Listen", () => { it("Остановка прослушивания", () => { builder.stopListen(); - assert.ok(pagesStorage.get(builder.id) === undefined); + assert.ok(PagesManager.hasBuilder(builder.id) === false); }); } });