Skip to content
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.

Commit

Permalink
test: add missing test for globalTop/top implication
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Aug 19, 2021
1 parent 6a6b6e4 commit f432838
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -2638,3 +2638,23 @@ t.test('children are unicode-normalizing and case-insensitive', t => {
})
t.end()
})

t.test('children of the global root are considered tops', t => {
const tree = new Node({
path: '/usr/local/lib',
global: true,
children: [
{
pkg: { name: 'foo', version: '1.2.3' },
children: [{ pkg: { name: 'bar', version: '1.2.3' }}],
},
],
})
const foo = tree.children.get('foo')
const bar = foo.children.get('bar')
t.equal(foo.isTop, true)
t.equal(foo.top, foo)
t.equal(bar.top, foo)
t.end()
t.equal(foo.isTop, true)
})

0 comments on commit f432838

Please sign in to comment.