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

scriptype / writ-cms / 19316730697

13 Nov 2025 12:49AM UTC coverage: 19.323% (+0.7%) from 18.626%
19316730697

push

github

scriptype
Introduce ContentModelNode

A ContentModelNode class is implemented by abstracting out the most
basic model: attachment.

So far models that extend ContentModelNode are: attachment, asset,
homepage, subpage.

_baseEntry's main functionality is extracted into small helpers in a new
helper module called parseTextEntry

ContentModel's helpers are duplicated into lib/ContentModelHelpers with
the idea of eventually nothing in contentModel needing to use those
helpers or something like that.

Next: post, category, collection, contentModel index

146 of 3405 branches covered (4.29%)

Branch coverage included in aggregate %.

119 of 189 new or added lines in 10 files covered. (62.96%)

10 existing lines in 2 files now uncovered.

916 of 2091 relevant lines covered (43.81%)

101.37 hits per line

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

78.95
/src/lib/ContentModelNode.js
1
const { join } = require('path')
9✔
2
const _ = require('lodash')
9✔
3
const { makePermalink } = require('./contentModelHelpers')
9✔
4

5
class ContentModelNode {
6
  constructor(fsNode, context, settings = {}) {
×
7
    this.fsNode = fsNode
144✔
8
    this.context = context
144✔
9
    this.settings = settings
144✔
10
    this.date = new Date(this.fsNode.stats?.birthtime || Date.now())
144✔
11
    this.permalink = this.getPermalink()
144✔
12
    this.outputPath = this.getOutputPath()
144✔
13
    this.subtreeMatchers = this.getSubtreeMatchers()
144✔
14
    this.subtree = this.parseSubtree()
144✔
15
  }
16

17
  getPermalink() {
NEW
18
    return makePermalink(
×
19
      ..._.compact([
20
        this.context.peek()?.permalink,
21
        this.fsNode.name
22
      ])
23
    )
24
  }
25

26
  getOutputPath() {
NEW
27
    return join(
×
28
      ..._.compact([
29
        this.context.peek()?.outputPath,
30
        this.fsNode.name
31
      ])
32
    )
33
  }
34

35
  getSubtreeMatchers() {
36
    return {}
144✔
37
  }
38

39
  parseSubtree() {
NEW
40
    return {}
×
41
  }
42

43
  afterEffects(contentModel) {}
44

45
  render(renderer) {}
46
}
47

48
module.exports = ContentModelNode
9✔
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