• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

u-wave / core / 11085094286

28 Sep 2024 03:39PM UTC coverage: 79.715% (-0.4%) from 80.131%
11085094286

Pull #637

github

web-flow
Merge 11ccf3b06 into 14c162f19
Pull Request #637: Switch to a relational database, closes #549

751 of 918 branches covered (81.81%)

Branch coverage included in aggregate %.

1891 of 2530 new or added lines in 50 files covered. (74.74%)

13 existing lines in 7 files now uncovered.

9191 of 11554 relevant lines covered (79.55%)

68.11 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

98.15
/src/models/Playlist.js
1
import mongoose from 'mongoose';
1✔
2

1✔
3
const { Schema } = mongoose;
1✔
4
const { Types } = mongoose.Schema;
1✔
5

1✔
6
/**
1✔
7
 * @typedef {object} LeanPlaylist
1✔
8
 * @prop {import('mongodb').ObjectId} _id
1✔
9
 * @prop {string} name
1✔
10
 * @prop {string} description
1✔
11
 * @prop {import('mongodb').ObjectId} author
1✔
12
 * @prop {import('mongodb').ObjectId[]} media
1✔
13
 * @prop {Date} createdAt
1✔
14
 * @prop {Date} updatedAt
1✔
15
 * @typedef {mongoose.Document<LeanPlaylist["_id"], {}, LeanPlaylist> & LeanPlaylist & {
1✔
16
 *  readonly size: number
1✔
17
 * }} Playlist
1✔
18
 */
1✔
19

1✔
20
/**
1✔
21
 * @type {mongoose.Schema<Playlist, mongoose.Model<Playlist>>}
1✔
22
 */
1✔
23
const schema = new Schema({
1✔
24
  name: {
1✔
25
    type: String,
1✔
26
    min: 0,
1✔
27
    max: 128,
1✔
28
    required: true,
1✔
29
    /** @type {(name: string) => string} */
1✔
30
    set: (name) => name.normalize('NFKC'),
1✔
31
  },
1✔
32
  description: { type: String, min: 0, max: 512 },
1✔
33
  author: {
1✔
34
    type: Types.ObjectId, ref: 'User', required: true, index: true,
1✔
35
  },
1✔
36
  media: [{
1✔
37
    type: Types.ObjectId,
1✔
38
    ref: 'PlaylistItem',
1✔
39
    required: true,
1✔
40
    index: true,
1✔
41
  }],
1✔
42
}, {
1✔
43
  collection: 'playlists',
1✔
44
  timestamps: true,
1✔
45
  toJSON: { getters: true },
1✔
46
  minimize: false,
1✔
47
});
1✔
48

1✔
49
schema.virtual('size').get(/** @this {Playlist} */ function size() {
1✔
UNCOV
50
  return this.media.length;
×
51
});
1✔
52

1✔
53
export default schema;
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc