1
1
const SteamWorkshopScraper = require ( '../index.js' ) ;
2
2
const sws = new SteamWorkshopScraper ( 'Universal' ) ;
3
3
var assert = require ( 'assert' ) ;
4
-
4
+ const { DateTime } = require ( "luxon" ) ;
5
5
6
6
describe ( 'SteamWorkshopScraper' , function ( ) {
7
7
it ( 'should show 18 entries' , async function ( ) {
@@ -54,15 +54,13 @@ describe('SteamWorkshopScraper', function () {
54
54
55
55
it ( 'GetChangeLog check text and timePosted' , async function ( ) {
56
56
await sws . GetChangeLog ( 478528785 ) . then ( function ( data ) { // very old mod
57
- // console.log('data', data.data[0].text);
58
57
assert . equal ( data . data [ 0 ] . text , 'Version 1.0' ) ;
59
58
assert . equal ( data . data [ 0 ] . timePosted , '2015-07-09T21:59:00.000+00:00' ) ;
60
59
} ) ;
61
60
} ) ;
62
61
63
62
it ( 'GetInfo never updated mod' , async function ( ) {
64
63
await sws . GetInfo ( 518030553 ) . then ( function ( data ) {
65
- // console.log(data);
66
64
assert . equal ( data . title , 'TXM: Turret Expansion Mod' ) ;
67
65
assert . equal ( data . size , '0.036 MB' ) ;
68
66
assert . equal ( data . timePublished , '2015-09-14T01:52:00.000+00:00' ) ;
@@ -71,10 +69,19 @@ describe('SteamWorkshopScraper', function () {
71
69
} ) ;
72
70
} ) ;
73
71
72
+ it ( 'GetInfo active updated mod' , async function ( ) {
73
+ await sws . GetInfo ( 731604991 ) . then ( function ( data ) {
74
+ assert . equal ( data . title , 'Structures Plus (S+)' ) ;
75
+ assert . equal ( data . size , '58.174 MB' ) ;
76
+ assert . equal ( data . timePublished , '2016-07-26T02:40:00.000+00:00' ) ;
77
+ assert . equal ( data . timeUpdated . includes ( DateTime . now ( ) . year ) , true ) ;
78
+ assert . equal ( data . image , 'https://steamuserimages-a.akamaihd.net/ugc/1020574589494908839/7C3E05B2D3568E166D1E9B0A7597782934F2A153/?imw=268&imh=268&ima=fit&impolicy=Letterbox&imcolor=%23000000&letterbox=true' ) ;
79
+ } ) ;
80
+ } ) ;
81
+
74
82
it ( 'Timezone' , async function ( ) {
75
83
const swsTZ = new SteamWorkshopScraper ( 'Europe/Vienna' ) ;
76
84
await swsTZ . GetInfo ( 518030553 ) . then ( function ( data ) {
77
- // console.log(data);
78
85
assert . equal ( data . title , 'TXM: Turret Expansion Mod' ) ;
79
86
assert . equal ( data . size , '0.036 MB' ) ;
80
87
assert . equal ( data . timePublished , '2015-09-14T03:52:00.000+02:00' ) ;
0 commit comments