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
32 lines
859 B
Plaintext
32 lines
859 B
Plaintext
'use strict'
|
|
|
|
const { test } = require('node:test')
|
|
const { createCopier } = require('fast-copy')
|
|
const fastCopy = createCopier({})
|
|
const deleteLogProperty = require('./delete-log-property')
|
|
|
|
const logData = {
|
|
level: 30,
|
|
data1: {
|
|
data2: { 'data-3': 'bar' }
|
|
}
|
|
}
|
|
|
|
test('deleteLogProperty deletes property of depth 1', t => {
|
|
const log = fastCopy(logData)
|
|
deleteLogProperty(log, 'data1')
|
|
t.assert.deepStrictEqual(log, { level: 30 })
|
|
})
|
|
|
|
test('deleteLogProperty deletes property of depth 2', t => {
|
|
const log = fastCopy(logData)
|
|
deleteLogProperty(log, 'data1.data2')
|
|
t.assert.deepStrictEqual(log, { level: 30, data1: { } })
|
|
})
|
|
|
|
test('deleteLogProperty deletes property of depth 3', t => {
|
|
const log = fastCopy(logData)
|
|
deleteLogProperty(log, 'data1.data2.data-3')
|
|
t.assert.deepStrictEqual(log, { level: 30, data1: { data2: { } } })
|
|
})
|