mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-13 17:05:47 +01:00
Update tests
This commit is contained in:
@@ -23,6 +23,7 @@ describe('TorrentTile', () => {
|
|||||||
displayActiveTorrents: true,
|
displayActiveTorrents: true,
|
||||||
speedLimitOfActiveTorrents: 10,
|
speedLimitOfActiveTorrents: 10,
|
||||||
displayStaleTorrents: false,
|
displayStaleTorrents: false,
|
||||||
|
displayRatioWithFilter: false,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
const torrents: NormalizedTorrent[] = [
|
const torrents: NormalizedTorrent[] = [
|
||||||
@@ -60,6 +61,7 @@ describe('TorrentTile', () => {
|
|||||||
displayActiveTorrents: true,
|
displayActiveTorrents: true,
|
||||||
speedLimitOfActiveTorrents: 10,
|
speedLimitOfActiveTorrents: 10,
|
||||||
displayStaleTorrents: true,
|
displayStaleTorrents: true,
|
||||||
|
displayRatioWithFilter: false,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
const torrents: NormalizedTorrent[] = [
|
const torrents: NormalizedTorrent[] = [
|
||||||
@@ -97,6 +99,7 @@ describe('TorrentTile', () => {
|
|||||||
displayActiveTorrents: false,
|
displayActiveTorrents: false,
|
||||||
speedLimitOfActiveTorrents: 10,
|
speedLimitOfActiveTorrents: 10,
|
||||||
displayStaleTorrents: true,
|
displayStaleTorrents: true,
|
||||||
|
displayRatioWithFilter: false,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
const torrents: NormalizedTorrent[] = [
|
const torrents: NormalizedTorrent[] = [
|
||||||
@@ -134,12 +137,25 @@ describe('TorrentTile', () => {
|
|||||||
displayActiveTorrents: true,
|
displayActiveTorrents: true,
|
||||||
speedLimitOfActiveTorrents: 10,
|
speedLimitOfActiveTorrents: 10,
|
||||||
displayStaleTorrents: true,
|
displayStaleTorrents: true,
|
||||||
|
displayRatioWithFilter: false,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
const torrents: NormalizedTorrent[] = [
|
const torrents: NormalizedTorrent[] = [
|
||||||
constructTorrent('ABC', 'Nice Torrent', false, 672, 672),
|
constructTorrent('ABC', 'Nice Torrent', false, 672, 672),
|
||||||
constructTorrent('HH', 'I am completed and uploading less than 10 ko/s (10239 ≈ 9.99ko/s)', true, 0, 10239),
|
constructTorrent(
|
||||||
constructTorrent('HH', 'I am completed and uploading more than 10 ko/s (10241 ≈ 10.01ko/s)', true, 0, 10241),
|
'HH',
|
||||||
|
'I am completed and uploading less than 10 ko/s (10239 ≈ 9.99ko/s)',
|
||||||
|
true,
|
||||||
|
0,
|
||||||
|
10239
|
||||||
|
),
|
||||||
|
constructTorrent(
|
||||||
|
'HH',
|
||||||
|
'I am completed and uploading more than 10 ko/s (10241 ≈ 10.01ko/s)',
|
||||||
|
true,
|
||||||
|
0,
|
||||||
|
10241
|
||||||
|
),
|
||||||
constructTorrent('HH', 'I am completed', true, 0, 0),
|
constructTorrent('HH', 'I am completed', true, 0, 0),
|
||||||
constructTorrent('HH', 'I am stale', false, 0, 0),
|
constructTorrent('HH', 'I am stale', false, 0, 0),
|
||||||
];
|
];
|
||||||
@@ -175,6 +191,7 @@ describe('TorrentTile', () => {
|
|||||||
displayActiveTorrents: true,
|
displayActiveTorrents: true,
|
||||||
speedLimitOfActiveTorrents: 10,
|
speedLimitOfActiveTorrents: 10,
|
||||||
displayStaleTorrents: true,
|
displayStaleTorrents: true,
|
||||||
|
displayRatioWithFilter: false,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
const torrents: NormalizedTorrent[] = [
|
const torrents: NormalizedTorrent[] = [
|
||||||
@@ -212,6 +229,7 @@ describe('TorrentTile', () => {
|
|||||||
displayActiveTorrents: false,
|
displayActiveTorrents: false,
|
||||||
speedLimitOfActiveTorrents: 10,
|
speedLimitOfActiveTorrents: 10,
|
||||||
displayStaleTorrents: true,
|
displayStaleTorrents: true,
|
||||||
|
displayRatioWithFilter: false,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
const torrents: NormalizedTorrent[] = [
|
const torrents: NormalizedTorrent[] = [
|
||||||
@@ -249,11 +267,10 @@ describe('TorrentTile', () => {
|
|||||||
displayActiveTorrents: false,
|
displayActiveTorrents: false,
|
||||||
speedLimitOfActiveTorrents: 10,
|
speedLimitOfActiveTorrents: 10,
|
||||||
displayStaleTorrents: true,
|
displayStaleTorrents: true,
|
||||||
|
displayRatioWithFilter: false,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
const torrents: NormalizedTorrent[] = [
|
const torrents: NormalizedTorrent[] = [constructTorrent('HH', 'I am completed', true, 0, 0)];
|
||||||
constructTorrent('HH', 'I am completed', true, 0),
|
|
||||||
];
|
|
||||||
|
|
||||||
// act
|
// act
|
||||||
const filtered = filterTorrents(widget, torrents);
|
const filtered = filterTorrents(widget, torrents);
|
||||||
@@ -263,7 +280,7 @@ describe('TorrentTile', () => {
|
|||||||
// assert
|
// assert
|
||||||
expect(filtered.length).toBe(0);
|
expect(filtered.length).toBe(0);
|
||||||
expect(filtered.includes(torrents[1])).toBe(false);
|
expect(filtered.includes(torrents[1])).toBe(false);
|
||||||
expect(ratioGlobal).toBe(378535535/23024335);
|
expect(ratioGlobal).toBe(378535535 / 23024335);
|
||||||
expect(ratioWithFilter).toBe(-1); //infinite ratio
|
expect(ratioWithFilter).toBe(-1); //infinite ratio
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -28,6 +28,10 @@ vitest.mock('./../../tools/server/getServerSideTranslations.ts', () => ({
|
|||||||
getServerSideTranslations: () => null,
|
getServerSideTranslations: () => null,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
vitest.mock('../../../src/server/api/routers/docker/router.ts', () => ({
|
||||||
|
dockerRouter: () => null,
|
||||||
|
}));
|
||||||
|
|
||||||
describe('[slug] page', () => {
|
describe('[slug] page', () => {
|
||||||
it('getServerSideProps should return not found when no params', async () => {
|
it('getServerSideProps should return not found when no params', async () => {
|
||||||
// arrange
|
// arrange
|
||||||
|
|||||||
Reference in New Issue
Block a user