From f866e6532710b64c186851df88f990787f2897ee Mon Sep 17 00:00:00 2001 From: Wes Todd Date: Thu, 19 Oct 2023 08:37:14 -0500 Subject: [PATCH] fix!: codename should be null on non-lts (#21) --- index.js | 2 +- test/index.js | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 453ffdf..8d17990 100644 --- a/index.js +++ b/index.js @@ -83,7 +83,7 @@ async function getLatestVersionsByCodename (now, cache, mirror) { const aliases = versions.reduce((obj, ver) => { const { major, minor, patch, tag } = splitVersion(ver.version) const versionName = major !== '0' ? `v${major}` : `v${major}.${minor}` - const codename = ver.lts ? ver.lts.toLowerCase() : versionName + const codename = ver.lts ? ver.lts.toLowerCase() : null const version = tag !== '' ? `${major}.${minor}.${patch}-${tag}` : `${major}.${minor}.${patch}` const s = schedule[versionName] diff --git a/test/index.js b/test/index.js index cba2ab0..fc12fd2 100644 --- a/test/index.js +++ b/test/index.js @@ -177,4 +177,9 @@ suite('nv', () => { assert.strictEqual(versions[0].major, 0) assert.strictEqual(versions[0].isLts, false) }) + + test('codename null on non-lts', async () => { + const versions = await nv('0.8.0', { now }) + assert.strictEqual(versions[0].codename, null) + }) })