From 89ee0f8d27ac078697dd1a1eb3081d621f3a75be Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Sat, 16 Nov 2024 15:16:13 +0500 Subject: [PATCH] core: fix sync tests and remove obsolete snapshots --- .../__e2e__/__snapshots__/offers.test.js.snap | 2 -- .../__snapshots__/pricing.test.js.snap | 18 ------------- packages/core/__e2e__/sync.test.js | 25 ++----------------- 3 files changed, 2 insertions(+), 43 deletions(-) diff --git a/packages/core/__e2e__/__snapshots__/offers.test.js.snap b/packages/core/__e2e__/__snapshots__/offers.test.js.snap index be68ed1624..00d563ca36 100644 --- a/packages/core/__e2e__/__snapshots__/offers.test.js.snap +++ b/packages/core/__e2e__/__snapshots__/offers.test.js.snap @@ -1,5 +1,3 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`get offer code > offer-code 1`] = `"123"`; - -exports[`get offer code > offer-code 2`] = `"123"`; diff --git a/packages/core/__e2e__/__snapshots__/pricing.test.js.snap b/packages/core/__e2e__/__snapshots__/pricing.test.js.snap index 1ace5ae40d..49e608e4c1 100644 --- a/packages/core/__e2e__/__snapshots__/pricing.test.js.snap +++ b/packages/core/__e2e__/__snapshots__/pricing.test.js.snap @@ -63,15 +63,6 @@ exports[`get web pricing tier > get monthly web tier > monthly-web-pricing 1`] = } `; -exports[`get web pricing tier > get monthly web tier > yearly-ios-pricing 1`] = ` -{ - "country": Any, - "countryCode": Any, - "discount": Any, - "sku": Any, -} -`; - exports[`get web pricing tier > get yearly web tier > yearly-web-pricing 1`] = ` { "country": Any, @@ -81,15 +72,6 @@ exports[`get web pricing tier > get yearly web tier > yearly-web-pricing 1`] = ` } `; -exports[`get yearly price > monthly-pricing 1`] = ` -{ - "country": Any, - "countryCode": Any, - "discount": Any, - "price": Any, -} -`; - exports[`get yearly price > yearly-pricing 1`] = ` { "country": Any, diff --git a/packages/core/__e2e__/sync.test.js b/packages/core/__e2e__/sync.test.js index b20a515f5d..90a8785dc0 100644 --- a/packages/core/__e2e__/sync.test.js +++ b/packages/core/__e2e__/sync.test.js @@ -17,16 +17,10 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -import Database from "../src/api/index.ts"; -import { NodeStorageInterface } from "../__mocks__/node-storage.mock.ts"; -import { FS } from "../__mocks__/fs.mock.ts"; -import Compressor from "../__mocks__/compressor.mock.js"; import { CHECK_IDS, EV, EVENTS } from "../src/common.ts"; -import { EventSource } from "event-source-polyfill"; import { test, expect, vitest } from "vitest"; import { login } from "./utils.js"; -import { SqliteDialect } from "@streetwriters/kysely"; -import BetterSQLite3 from "better-sqlite3-multiple-ciphers"; +import { databaseTest } from "../__tests__/utils/index.ts"; const TEST_TIMEOUT = 60 * 1000; @@ -499,22 +493,7 @@ async function initializeDevice(id, capabilities = []) { }; }); - const device = new Database(); - device.setup({ - storage: new NodeStorageInterface(), - eventsource: EventSource, - fs: FS, - compressor: async () => Compressor, - sqliteOptions: { - dialect: (name) => - new SqliteDialect({ - database: BetterSQLite3(":memory:").unsafeMode(true) - }) - }, - batchSize: 500 - }); - - await device.init(); + const device = await databaseTest("memory"); await login(device);