Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
danielailie committed Sep 11, 2023
1 parent 476780d commit 68658fd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { getRepositoryToken } from '@nestjs/typeorm';
import { AnalyticsDataSetterService } from '../analytics-data.setter.service';
import { XNftsAnalyticsEntity } from '../entities/analytics.entity';
import { Logger } from '@nestjs/common';
import '@multiversx/sdk-nestjs/lib/src/utils/extensions/array.extensions';
import '@multiversx/sdk-nestjs-common/lib/utils/extensions/array.extensions';

describe('Analytics Data Setter Service', () => {
let service: AnalyticsDataSetterService;
Expand Down
14 changes: 7 additions & 7 deletions src/modules/campaigns/tests/campaigns.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ describe('Campaigns Service', () => {

describe('getCampaigns', () => {
it('without filters returns full list', async () => {
const cacheService = module.get<CachingService>(CachingService);
const cacheService = module.get<CacheService>(CacheService);
jest.spyOn(cacheService, 'getOrSet').mockImplementation(() =>
Promise.resolve(
new CollectionType({
Expand All @@ -85,7 +85,7 @@ describe('Campaigns Service', () => {
});

it('when filters by campaignId and minterAddress returns list with one item', async () => {
const cacheService = module.get<CachingService>(CachingService);
const cacheService = module.get<CacheService>(CacheService);
jest.spyOn(cacheService, 'getOrSet').mockImplementation(() =>
Promise.resolve(
new CollectionType({
Expand Down Expand Up @@ -113,7 +113,7 @@ describe('Campaigns Service', () => {
});

it('when filters by campaignId list with that campaignId', async () => {
const cacheService = module.get<CachingService>(CachingService);
const cacheService = module.get<CacheService>(CacheService);
jest.spyOn(cacheService, 'getOrSet').mockImplementation(() =>
Promise.resolve(
new CollectionType({
Expand All @@ -140,7 +140,7 @@ describe('Campaigns Service', () => {
});

it('when filters by minterAddress list with that minterAddress', async () => {
const cacheService = module.get<CachingService>(CachingService);
const cacheService = module.get<CacheService>(CacheService);
jest.spyOn(cacheService, 'getOrSet').mockImplementation(() =>
Promise.resolve(
new CollectionType({
Expand Down Expand Up @@ -170,7 +170,7 @@ describe('Campaigns Service', () => {
describe('saveCampaign', () => {
it('when no campaign present returns empty list', async () => {
const nftMinterService = module.get<NftMinterAbiService>(NftMinterAbiService);
const cacheService = module.get<CachingService>(CachingService);
const cacheService = module.get<CacheService>(CacheService);
jest.spyOn(nftMinterService, 'getCampaignsForScAddress').mockImplementation(() => Promise.resolve([]));
jest.spyOn(cacheService, 'getOrSet').mockImplementation(() => Promise.resolve(7));

Expand All @@ -184,7 +184,7 @@ describe('Campaigns Service', () => {
it('when one campaign present returns list with one item', async () => {
const nftMinterService = module.get<NftMinterAbiService>(NftMinterAbiService);
const persistenceService = module.get<PersistenceService>(PersistenceService);
const cacheService = module.get<CachingService>(CachingService);
const cacheService = module.get<CacheService>(CacheService);
jest.spyOn(cacheService, 'getOrSet').mockImplementation(() => Promise.resolve(7));
jest.spyOn(persistenceService, 'saveCampaign').mockImplementation(() => Promise.resolve(saveCampaignInput[0]));
jest.spyOn(persistenceService, 'saveTiers').mockImplementation(() => Promise.resolve([]));
Expand All @@ -201,7 +201,7 @@ describe('Campaigns Service', () => {
it('when 2 campaigns present returns list with 2 items', async () => {
const nftMinterService = module.get<NftMinterAbiService>(NftMinterAbiService);
const persistenceService = module.get<PersistenceService>(PersistenceService);
const cacheService = module.get<CachingService>(CachingService);
const cacheService = module.get<CacheService>(CacheService);
jest.spyOn(cacheService, 'getOrSet').mockImplementation(() => Promise.resolve(7));
jest
.spyOn(persistenceService, 'saveCampaign')
Expand Down

0 comments on commit 68658fd

Please sign in to comment.