diff options
author | Chocobozzz <me@florianbigard.com> | 2019-03-05 10:58:44 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-03-18 11:17:59 +0100 |
commit | df0b219d36bf6852cdf2a7ad09ed4a41c6bccefa (patch) | |
tree | c4984e854f5dc18e5c27afd73b843bd52c143034 /server/helpers/custom-validators/activitypub/playlist.ts | |
parent | 07b1a18aa678d260009a93e36606c5c5f585723d (diff) | |
download | PeerTube-df0b219d36bf6852cdf2a7ad09ed4a41c6bccefa.tar.gz PeerTube-df0b219d36bf6852cdf2a7ad09ed4a41c6bccefa.tar.zst PeerTube-df0b219d36bf6852cdf2a7ad09ed4a41c6bccefa.zip |
Add playlist rest tests
Diffstat (limited to 'server/helpers/custom-validators/activitypub/playlist.ts')
-rw-r--r-- | server/helpers/custom-validators/activitypub/playlist.ts | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/server/helpers/custom-validators/activitypub/playlist.ts b/server/helpers/custom-validators/activitypub/playlist.ts index ecdc7975e..6c7bdb193 100644 --- a/server/helpers/custom-validators/activitypub/playlist.ts +++ b/server/helpers/custom-validators/activitypub/playlist.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { exists } from '../misc' | 1 | import { exists, isDateValid } from '../misc' |
2 | import { PlaylistObject } from '../../../../shared/models/activitypub/objects/playlist-object' | 2 | import { PlaylistObject } from '../../../../shared/models/activitypub/objects/playlist-object' |
3 | import * as validator from 'validator' | 3 | import * as validator from 'validator' |
4 | import { PlaylistElementObject } from '../../../../shared/models/activitypub/objects/playlist-element-object' | 4 | import { PlaylistElementObject } from '../../../../shared/models/activitypub/objects/playlist-element-object' |
@@ -7,7 +7,9 @@ import { isActivityPubUrlValid } from './misc' | |||
7 | function isPlaylistObjectValid (object: PlaylistObject) { | 7 | function isPlaylistObjectValid (object: PlaylistObject) { |
8 | return exists(object) && | 8 | return exists(object) && |
9 | object.type === 'Playlist' && | 9 | object.type === 'Playlist' && |
10 | validator.isInt(object.totalItems + '') | 10 | validator.isInt(object.totalItems + '') && |
11 | isDateValid(object.published) && | ||
12 | isDateValid(object.updated) | ||
11 | } | 13 | } |
12 | 14 | ||
13 | function isPlaylistElementObjectValid (object: PlaylistElementObject) { | 15 | function isPlaylistElementObjectValid (object: PlaylistElementObject) { |