From 2ab308ce3a0b3bf2d05f00bb501fc9896f0d5106 Mon Sep 17 00:00:00 2001 From: Hoang Tien Minh Date: Sun, 16 Jun 2024 22:55:57 +0700 Subject: [PATCH] chore: add test to simulate null target link --- workspaces/arborist/test/node.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/workspaces/arborist/test/node.js b/workspaces/arborist/test/node.js index f5090dc2def5a..e5fc72e4a1d66 100644 --- a/workspaces/arborist/test/node.js +++ b/workspaces/arborist/test/node.js @@ -8,6 +8,7 @@ const { resolve } = require('node:path') const treeCheck = require('../lib/tree-check.js') const { normalizePath, normalizePaths } = require('./fixtures/utils.js') +const { realpath } = require('node:fs') t.cleanSnapshot = str => str.split(process.cwd()).join('{CWD}') @@ -1548,6 +1549,13 @@ t.test('detect that two nodes are the same thing', async t => { const b = new Node({ parent: a, pkg: pkgb }) check(a, b, false, 'name/version mismatch, if no resolved/integrity') } + + { + const root = new Node({ path: '/x' }) + const a = new Link({ root, path: '/a', realpath: '/a', target: null }) + const b = new Link({ root, path: '/b', realpath: '/b', target: null }) + check(a, b, false, 'links does not match if target to null') + } }) t.test('node.satisfies(requested)', t => {