Files
klz-cables.com/.pnpm-store/v10/files/32/fa8718139f0bdae684bbd0cb70a64219c39e474c9955d83866f5f47a1a595e9c8d94f42d5a647d23912c5f444c68b26371d3c32bc62c076340d4e37337264e
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

32 lines
1.2 KiB
Plaintext

'use strict'
const { test } = require('node:test')
const getPropertyValue = require('./get-property-value')
test('getPropertyValue returns the value of the property', t => {
const result = getPropertyValue({
foo: 'bar'
}, 'foo')
t.assert.strictEqual(result, 'bar')
})
test('getPropertyValue returns the value of the nested property', t => {
const result = getPropertyValue({ extra: { foo: { value: 'bar' } } }, 'extra.foo.value')
t.assert.strictEqual(result, 'bar')
})
test('getPropertyValue returns the value of the nested property using the array of nested property keys', t => {
const result = getPropertyValue({ extra: { foo: { value: 'bar' } } }, ['extra', 'foo', 'value'])
t.assert.strictEqual(result, 'bar')
})
test('getPropertyValue returns undefined for non-existing properties', t => {
const result = getPropertyValue({ extra: { foo: { value: 'bar' } } }, 'extra.foo.value-2')
t.assert.strictEqual(result, undefined)
})
test('getPropertyValue returns undefined for non-existing properties using the array of nested property keys', t => {
const result = getPropertyValue({ extra: { foo: { value: 'bar' } } }, ['extra', 'foo', 'value-2'])
t.assert.strictEqual(result, undefined)
})