Closed johannpinson closed 1 year ago
Updated version of the test to get the duplicate entry
describe('duplicate', () => {
it('detection', async () => {
const presets = await Promise.all(
[
resolvePreset('abbreviates'),
resolvePreset('brands'),
resolvePreset('general'),
resolvePreset('products'),
resolvePreset('softwares'),
],
)
const allPresets = await loadAllPresets()
presets.forEach((preset) => {
Object.keys(preset).forEach((key) => {
const index = Object.keys(allPresets).findIndex(k => k === key)
if (index >= 0)
delete allPresets[Object.keys(allPresets)[index]]
else
throw new Error(key)
})
})
expect(Object.keys(allPresets).length).toEqual(0)
})
})
FAIL test/index.test.ts > duplicate > detection
Error: sql
❯ test/index.test.ts:77:16
75| delete allPresets[Object.keys(allPresets)[index]]
76| else
77| throw new Error(key)
| ^
78|
79| })
❯ test/index.test.ts:69:26
❯ test/index.test.ts:68:12
sql
can be found inside theabbreviates.json
andsoftwares.json
Hi,
This is a little update to remove a duplicate entry for
CodePen
from the previous release and the PR #145. After running a litte test, I see another duplicate item forCodeSandbox
.I didn't push my test because it's the first I write, so I'm not sure it was done well:
I could have used a
while/for
statement to remove entry until detect the duplicate item, but I don't know if it must be inside the test 🤷♂️.