Skip to content

Commit

Permalink
test: lockfile-file
Browse files Browse the repository at this point in the history
  • Loading branch information
zkochan committed Jul 28, 2022
1 parent bf07b1c commit 4de3a48
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions packages/lockfile-file/test/normalizeLockfile.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,45 @@ test('empty overrides and neverBuiltDependencies are removed during lockfile nor
},
})
})

test('empty specifiers field is preserved', () => {
expect(normalizeLockfile({
lockfileVersion: LOCKFILE_VERSION,
packages: {},
importers: {
foo: {
specifiers: {},
},
},
}, {
forceSharedFormat: false,
includeEmptySpecifiersField: true,
})).toStrictEqual({
lockfileVersion: LOCKFILE_VERSION,
importers: {
foo: {
specifiers: {},
},
},
})
})

test('empty specifiers field is removed', () => {
expect(normalizeLockfile({
lockfileVersion: LOCKFILE_VERSION,
packages: {},
importers: {
foo: {
specifiers: {},
},
},
}, {
forceSharedFormat: false,
includeEmptySpecifiersField: false,
})).toStrictEqual({
lockfileVersion: LOCKFILE_VERSION,
importers: {
foo: {},
},
})
})

0 comments on commit 4de3a48

Please sign in to comment.