-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtests.dma.spec.ts
More file actions
71 lines (59 loc) · 2.28 KB
/
tests.dma.spec.ts
File metadata and controls
71 lines (59 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import { Test, TestingModule } from '@nestjs/testing';
import { DateTime } from 'luxon';
import { TestsDma } from '../src/tests.dma';
import { commodityItem, item, wowTokenItem } from '../mocks';
describe('DMA', () => {
let testsService: TestsDma;
jest.setTimeout(600_000);
beforeAll(async () => {
const app: TestingModule = await Test.createTestingModule({
controllers: [],
providers: [TestsDma],
}).compile();
testsService = app.get<TestsDma>(TestsDma);
});
describe('COMMDTY', () => {
it('commodities response', async () => {
const response = await testsService.commodity();
expect(response).toHaveProperty('lastModified');
expect(response).toHaveProperty('auctions');
expect(Array.isArray(response.auctions)).toBeTruthy();
const lastModified = DateTime.fromRFC2822(response.lastModified).toJSDate();
expect(lastModified).toEqual(expect.any(Date));
const [item] = response.auctions;
expect(item).toMatchObject(commodityItem);
});
});
describe('AUCTIONS', () => {
it('auctions response', async () => {
const response = await testsService.auctions(1615);
expect(response).toHaveProperty('lastModified');
expect(response).toHaveProperty('auctions');
expect(Array.isArray(response.auctions)).toBeTruthy();
const lastModified = DateTime.fromRFC2822(response.lastModified).toJSDate();
expect(lastModified).toEqual(expect.any(Date));
response.auctions.map((auction) => expect(auction.item.id).toEqual(expect.any(Number)));
});
});
describe('WOWTOKEN', () => {
it('wowtoken response', async () => {
const response = await testsService.wowToken();
expect(response).toMatchObject(wowTokenItem);
expect(response).toHaveProperty('lastModified');
const lastModified = DateTime.fromRFC2822(response.lastModified).toJSDate();
expect(lastModified).toEqual(expect.any(Date));
});
});
describe('ITEM', () => {
it('item response', async () => {
const response = await testsService.item(191341);
expect(response).toMatchObject(item);
});
});
describe('ITEM MEDIA', () => {
it('item media response', async () => {
const response = await testsService.itemMedia(191341);
console.log(response);
});
});
});