Skip to content

Commit

Permalink
updated imports to reflect new folder structure
Browse files Browse the repository at this point in the history
# fixed small true/false logic bug
# removed isGame method from steamApp
# updated tests to reflect change
  • Loading branch information
lukatarman committed Jan 19, 2024
1 parent 8078f29 commit 7a79a0d
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 61 deletions.
4 changes: 2 additions & 2 deletions backend/src/adapters/driven/http/steam.client.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SteamApp } from "../models/steam.app.js";
import { ValidDataSources } from "../models/valid.data.sources.js";
import { SteamApp } from "../../../core/models/steam.app.js";
import { ValidDataSources } from "../../../core/models/valid.data.sources.js";

export class SteamClient {
#httpClient;
Expand Down
9 changes: 5 additions & 4 deletions backend/src/core/features/game-identifier/game.identifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,13 @@ export class GameIdentifier {
};

#steamAppsIsEmpty(steamApps) {
if (steamApps.length === 0) return true;
if (steamApps.length > 0) return false;

this.#logger.debugc(
`no steam apps in db, retry in: ${this.#options.globalIterationDelay} ms`,
);
return false;

return true;
}

async #identifyTypes(steamApps, source) {
Expand Down Expand Up @@ -114,15 +115,15 @@ export class GameIdentifier {
};

#gamesIsEmpty = (games, message) => {
if (games.length === 0) return true;
if (games.length > 0) return false;

this.#logger.debugc(
`no games without ${message} in db, retrying in ${
this.#options.globalIterationDelay
} ms`,
);

return false;
return true;
};

async #updateMissingDetails(games, steamApps) {
Expand Down
4 changes: 2 additions & 2 deletions backend/src/core/models/steam.app.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ export class SteamApp {
this.failedVia.push(source);
}

isGame() {
return this.type === SteamApp.validTypes.game;
get appType() {
return this.type;
}

set appType(type) {
Expand Down
36 changes: 0 additions & 36 deletions backend/src/core/models/steam.app.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,42 +96,6 @@ describe("SteamApp", function () {
});
});

describe(".isGame", function () {
describe("checks if the type property of the class instance equals 'games'. So, ", function () {
describe("if an app's type property equals 'game'", function () {
beforeAll(function () {
this.app = {
name: "Castlevania",
appid: 1,
};

this.steamApp = SteamApp.oneFromSteamApi(this.app);
this.steamApp.type = SteamApp.validTypes.game;
});

it("the method returns true", function () {
expect(this.steamApp.isGame()).toBeTrue();
});
});

describe("if an app's type property does not equal 'game'", function () {
beforeAll(function () {
this.app = {
name: "Castlevania",
appid: 1,
};

this.steamApp = SteamApp.oneFromSteamApi(this.app);
this.steamApp.type = SteamApp.validTypes.unknown;
});

it("the method returns false", function () {
expect(this.steamApp.isGame()).toBeFalse();
});
});
});
});

describe(".appType", function () {
describe("sets the 'type' property to whatever was passed in as an argument. When this is done,", function () {
beforeAll(function () {
Expand Down
34 changes: 17 additions & 17 deletions backend/src/main.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import httpClient from "axios";
import { DatabaseClient } from "./infrastructure/database/database.client.js";
import { SteamClient } from "./infrastructure/steam.client.js";
import { SteamAppsAggregator } from "./features/steam-apps-aggregator/steam.apps.aggregator.js";
import { GameIdentifier } from "./features/game-identifier/game.identifier.js";
import { PlayerHistoryAggregator } from "./features/player-history-aggregator/player.history.aggregator.js";
import { Runner } from "./utils/runner.js";
import { WebServer } from "./infrastructure/web.server.js";
import { GameQueriesController } from "./features/game-queries/game.queries.controller.js";
import { GameQueriesRouter } from "./features/game-queries/game.queries.router.js";
import { GamesRepository } from "./infrastructure/database/repositories/games.repository.js";
import { SteamAppsRepository } from "./infrastructure/database/repositories/steam.apps.repository.js";
import { SteamAppsUpdateTimestampsRepository } from "./infrastructure/database/repositories/steam.apps.update.timestamps.repository.js";
import { PlayerHistoryRepository } from "./infrastructure/database/repositories/player.history.repository.js";
import { HistoryChecksRepository } from "./infrastructure/database/repositories/history.checks.repository.js";
import { config } from "./utils/config.loader.js";
import { Logger } from "./utils/logger.js";
import { ValidDataSources } from "./models/valid.data.sources.js";
import { DatabaseClient } from "./adapters/driven/db/database.client.js";
import { SteamClient } from "./adapters/driven/http/steam.client.js";
import { Runner } from "./adapters/driving/runner/runner.js";
import { WebServer } from "./adapters/driving/rest/web.server.js";
import { GameQueriesController } from "./adapters/driving/rest/game-queries/game.queries.controller.js";
import { GameQueriesRouter } from "./adapters/driving/rest/game-queries/game.queries.router.js";
import { SteamAppsAggregator } from "./core/features/steam-apps-aggregator/steam.apps.aggregator.js";
import { GameIdentifier } from "./core/features/game-identifier/game.identifier.js";
import { PlayerHistoryAggregator } from "./core/features/player-history-aggregator/player.history.aggregator.js";
import { GamesRepository } from "./core/repositories/games.repository.js";
import { SteamAppsRepository } from "./core/repositories/steam.apps.repository.js";
import { SteamAppsUpdateTimestampsRepository } from "./core/repositories/steam.apps.update.timestamps.repository.js";
import { PlayerHistoryRepository } from "./core/repositories/player.history.repository.js";
import { HistoryChecksRepository } from "./core/repositories/history.checks.repository.js";
import { config } from "./common/config.loader.js";
import { Logger } from "./common/logger.js";
import { ValidDataSources } from "./core/models/valid.data.sources.js";

// our entry point = main
async function main() {
Expand Down

0 comments on commit 7a79a0d

Please sign in to comment.