Skip to content

Commit

Permalink
chore: Remove unecesary hydrated element
Browse files Browse the repository at this point in the history
  • Loading branch information
DevStarlight committed Oct 17, 2024
1 parent a784d31 commit f88fe94
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 60 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [6.0.1] - 2024-10-17

### Changed

- Remove unecesary hydrated element

## [6.0.0] - 2024-10-14

### Added
Expand Down
5 changes: 1 addition & 4 deletions test/models/assistants.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { HydratedDocument } from 'mongoose';

import { AssistantDocument } from '../../src/types';
import { mongoose, AssistantModel } from '../../src';
import createAssistant from '../helpers/create-assistant';
import { AssistantAttributes } from '../../src/interfaces';

const testDatabase = require('../test-db')(mongoose);

Expand All @@ -13,7 +10,7 @@ describe('Assistant', () => {
afterAll(() => testDatabase.close());

describe('when create a new assistant', () => {
let assistantObject: HydratedDocument<AssistantAttributes>;
let assistantObject: AssistantDocument;

beforeAll(async () => {
assistantObject = await createAssistant();
Expand Down
9 changes: 3 additions & 6 deletions test/models/conversation-chunks.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import { HydratedDocument } from 'mongoose';

import { ConversationAttributes, ConversationChunkAttributes } from '../../src/interfaces';
import { ConversationChunkDocument } from '../../src/types';
import { ConversationChunkDocument, ConversationDocument } from '../../src/types';
import createConversation from '../helpers/create-conversation';
import createConversationChunk from '../helpers/create-conversation-chunk';
import { mongoose, ConversationChunkModel, ConversationModel } from '../../src';
Expand All @@ -14,8 +11,8 @@ describe('ConversationChunks', () => {
afterAll(() => testDatabase.close());

describe('when create a new conversation', () => {
let conversationObject: HydratedDocument<ConversationAttributes>;
let conversationChunkObject: HydratedDocument<ConversationChunkAttributes>;
let conversationObject: ConversationDocument;
let conversationChunkObject: ConversationChunkDocument;

beforeAll(async () => {
conversationObject = await createConversation({
Expand Down
9 changes: 3 additions & 6 deletions test/models/conversations.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { HydratedDocument } from 'mongoose';

import createPlayer from '../helpers/create-player';
import { ConversationDocument } from '../../src/types';
import { ConversationDocument, PlayerDocument } from '../../src/types';
import { mongoose, ConversationModel, PlayerModel } from '../../src';
import createConversation from '../helpers/create-conversation';
import { ConversationAttributes, PlayerAttributes } from '../../src/interfaces';

const testDatabase = require('../test-db')(mongoose);

Expand All @@ -22,8 +19,8 @@ describe('Conversation', () => {
});

describe('when create a new conversation', () => {
let playerObject: HydratedDocument<PlayerAttributes>;
let conversationObject: HydratedDocument<ConversationAttributes>;
let playerObject: PlayerDocument;
let conversationObject: ConversationDocument;

beforeAll(async () => {
playerObject = await createPlayer();
Expand Down
6 changes: 2 additions & 4 deletions test/models/event.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { HydratedDocument } from 'mongoose';

import createEvent from '../helpers/create-event';
import createPlayer from '../helpers/create-player';
import { EventModel, PlayerModel, mongoose } from '../../src';
Expand All @@ -13,8 +11,8 @@ describe('Events', () => {
afterAll(() => testDatabase.close());

describe('when creating a new player', () => {
let eventObject: HydratedDocument<EventDocument>;
let playerObject: HydratedDocument<PlayerDocument>;
let eventObject: EventDocument;
let playerObject: PlayerDocument;

beforeAll(async () => {
playerObject = await createPlayer();
Expand Down
11 changes: 4 additions & 7 deletions test/models/game-score.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { HydratedDocument } from 'mongoose';

import createGame from '../helpers/create-game';
import createPlayer from '../helpers/create-player';
import { GameScoreDocument } from '../../src/types';
import { GameDocument, GameScoreDocument, PlayerDocument } from '../../src/types';
import createGameScore from '../helpers/create-game-score';
import { mongoose, GameScoreModel, PlayerModel, GameModel } from '../../src';
import { GameAttributes, PlayerAttributes, GameScoreAttributes } from '../../src/interfaces';

const testDatabase = require('../test-db')(mongoose);

Expand All @@ -15,9 +12,9 @@ describe('GameScore', () => {
afterAll(() => testDatabase.close());

describe('when creating a new collect coins game', () => {
let userObject: HydratedDocument<PlayerAttributes>;
let gameObject: HydratedDocument<GameAttributes>;
let gameScoreObject: HydratedDocument<GameScoreAttributes>;
let userObject: PlayerDocument;
let gameObject: GameDocument;
let gameScoreObject: GameScoreDocument;

beforeAll(async () => {
[gameObject, userObject] = await Promise.all([createGame(), createPlayer()]);
Expand Down
5 changes: 1 addition & 4 deletions test/models/game.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { HydratedDocument } from 'mongoose';

import createGame from '../helpers/create-game';
import { GameDocument } from '../../src/types';
import { mongoose, GameModel } from '../../src';
import { GameAttributes } from '../../src/interfaces';

const testDatabase = require('../test-db')(mongoose);

Expand All @@ -13,7 +10,7 @@ describe('Game', () => {
afterAll(() => testDatabase.close());

describe('when creating a new collect coins game', () => {
let gameObject: HydratedDocument<GameAttributes>;
let gameObject: GameDocument;

beforeAll(async () => {
gameObject = await createGame();
Expand Down
13 changes: 5 additions & 8 deletions test/models/player-reward.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import { HydratedDocument } from 'mongoose';

import { RewardAttributes, PlayerRewardAttributes, PlayerAttributes } from '../../src/interfaces';
import { PlayerRewardDocument } from '../../src/types';
import { PlayerDocument, PlayerRewardDocument, RewardDocument } from '../../src/types';
import createReward from '../helpers/create-reward';
import createPlayer from '../helpers/create-player';
import rewardTypes from '../../src/constants/reward-types';
Expand All @@ -16,9 +13,9 @@ describe('PlayerReward', () => {
afterAll(() => testDatabase.close());

describe('when create a new player reward', () => {
let playerObject: HydratedDocument<PlayerAttributes>;
let rewardObject: HydratedDocument<RewardAttributes>;
let playerRewardObject: HydratedDocument<PlayerRewardAttributes>;
let playerObject: PlayerDocument;
let rewardObject: RewardDocument;
let playerRewardObject: PlayerRewardDocument;

beforeAll(async () => {
playerObject = await createPlayer();
Expand Down Expand Up @@ -47,7 +44,7 @@ describe('PlayerReward', () => {
expect(playerRewardDocument.createdAt).toBeDefined();
expect(playerRewardDocument.updatedAt).toBeDefined();
expect(playerRewardDocument.playerId).toBeDefined();
expect(playerRewardDocument.rewardId.toString()).toBe(rewardObject._id.toString());
expect(playerRewardDocument.rewardId.toString()).toBe(rewardObject._id?.toString());
});
});
});
6 changes: 2 additions & 4 deletions test/models/player-session.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { HydratedDocument } from 'mongoose';

import createPlayer from '../helpers/create-player';
import createPlayerSession from '../helpers/create-player-session';
import { PlayerSessionModel, PlayerModel, mongoose } from '../../src';
Expand All @@ -13,8 +11,8 @@ describe('player-session', () => {
afterAll(() => testDatabase.close());

describe('when creating a new player', () => {
let playerObject: HydratedDocument<PlayerDocument>;
let playerSessionObject: HydratedDocument<PlayerSessionDocument>;
let playerObject: PlayerDocument;
let playerSessionObject: PlayerSessionDocument;

beforeAll(async () => {
playerObject = await createPlayer();
Expand Down
4 changes: 1 addition & 3 deletions test/models/player.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { HydratedDocument } from 'mongoose';

import { PlayerDocument } from '../../src/types';
import { PlayerModel, mongoose } from '../../src';
import createPlayer from '../helpers/create-player';
Expand All @@ -12,7 +10,7 @@ describe('Players', () => {
afterAll(() => testDatabase.close());

describe('when creating a new player', () => {
let playerObject: HydratedDocument<PlayerDocument>;
let playerObject: PlayerDocument;

beforeAll(async () => {
playerObject = await createPlayer();
Expand Down
15 changes: 5 additions & 10 deletions test/models/reward.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@ import createReward from '../helpers/create-reward';

import { mongoose, RewardModel } from '../../src';
import RewardTypes from '../../src/constants/reward-types';
import {
DigitalAssetRewardAttributes,
InGameRewardAttributes,
RewardAttributes,
} from '../../src/interfaces';
import { HydratedDocument } from 'mongoose';
import { DigitalAssetRewardDocument, InGameRewardDocument, RewardDocument } from '../../src/types';

const testDatabase = require('../test-db')(mongoose);

Expand All @@ -17,7 +12,7 @@ describe('Game', () => {
afterAll(() => testDatabase.close());

describe(`Reward with ${RewardTypes.IN_GAME_ITEM}`, () => {
let playerRewardObject: HydratedDocument<RewardAttributes>;
let playerRewardObject: RewardDocument;

beforeAll(async () => {
playerRewardObject = await createReward(RewardTypes.IN_GAME_ITEM);
Expand All @@ -26,7 +21,7 @@ describe('Game', () => {
afterAll(() => RewardModel.deleteOne({ _id: playerRewardObject._id }));

test(`it should contain all the properties for ${RewardTypes.IN_GAME_ITEM}`, async () => {
const RewardDocument = <InGameRewardAttributes>(
const RewardDocument = <InGameRewardDocument>(
await RewardModel.findById(playerRewardObject._id)
);

Expand All @@ -43,7 +38,7 @@ describe('Game', () => {
});

describe(`Reward with ${RewardTypes.DIGITAL_ASSET}`, () => {
let playerRewardObject: HydratedDocument<RewardAttributes>;
let playerRewardObject: RewardDocument;

beforeAll(async () => {
playerRewardObject = await createReward(RewardTypes.DIGITAL_ASSET);
Expand All @@ -52,7 +47,7 @@ describe('Game', () => {
afterAll(() => RewardModel.deleteOne({ _id: playerRewardObject._id }));

test(`it should contain all the properties for ${RewardTypes.DIGITAL_ASSET}`, async () => {
const RewardDocument = <DigitalAssetRewardAttributes>(
const RewardDocument = <DigitalAssetRewardDocument>(
await RewardModel.findById(playerRewardObject._id)
);

Expand Down
6 changes: 2 additions & 4 deletions test/models/wallets.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { HydratedDocument } from 'mongoose';

import createWallet from '../helpers/create-wallet';
import createPlayer from '../helpers/create-player';
import { WalletModel, PlayerModel, mongoose } from '../../src';
Expand All @@ -13,8 +11,8 @@ describe('Wallets', () => {
afterAll(() => testDatabase.close());

describe('when creating a new player', () => {
let playerObject: HydratedDocument<PlayerDocument>;
let walletObject: HydratedDocument<WalletDocument>;
let playerObject: PlayerDocument;
let walletObject: WalletDocument;

beforeAll(async () => {
playerObject = await createPlayer();
Expand Down

0 comments on commit f88fe94

Please sign in to comment.