Skip to content

Commit

Permalink
fix(test/read): lstat -> stat
Browse files Browse the repository at this point in the history
  • Loading branch information
yorickvP committed Jun 2, 2022
1 parent fb6e94b commit d586a5a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions test/content/read.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ permissionError.code = 'EPERM'

// helpers
const getRead = (t, opts) => t.mock('../../lib/content/read', opts)
const getReadLstatFailure = (t, err) => getRead(t, {
const getReadStatFailure = (t, err) => getRead(t, {
'@npmcli/fs': Object.assign({}, require('@npmcli/fs'), {
async lstat (path) {
async stat (path) {
throw err
},
lstatSync () {
statSync () {
throw err
},
}),
Expand Down Expand Up @@ -261,7 +261,7 @@ t.test('read: opening large files', function (t) {
const CACHE = t.testdir()
const mockedRead = getRead(t, {
'@npmcli/fs': Object.assign({}, require('@npmcli/fs'), {
async lstat (path) {
async stat (path) {
return { size: Number.MAX_SAFE_INTEGER }
},
}),
Expand Down Expand Up @@ -370,7 +370,7 @@ t.test('hasContent: tests content existence', (t) => {
t.test('hasContent: permission error', (t) => {
const CACHE = t.testdir()
// setup a syntetic permission error
const mockedRead = getReadLstatFailure(t, permissionError)
const mockedRead = getReadStatFailure(t, permissionError)

t.plan(1)
t.rejects(
Expand All @@ -382,7 +382,7 @@ t.test('hasContent: permission error', (t) => {

t.test('hasContent: generic error', (t) => {
const CACHE = t.testdir()
const mockedRead = getReadLstatFailure(t, genericError)
const mockedRead = getReadStatFailure(t, genericError)

t.plan(1)
t.resolves(
Expand Down Expand Up @@ -426,7 +426,7 @@ t.test('hasContent.sync: checks content existence synchronously', (t) => {

t.test('hasContent.sync: permission error', (t) => {
const CACHE = t.testdir()
const mockedRead = getReadLstatFailure(t, permissionError)
const mockedRead = getReadStatFailure(t, permissionError)

t.throws(
() => mockedRead.hasContent.sync(CACHE, 'sha1-deadbeef sha1-13371337'),
Expand All @@ -438,7 +438,7 @@ t.test('hasContent.sync: permission error', (t) => {

t.test('hasContent.sync: generic error', (t) => {
const CACHE = t.testdir()
const mockedRead = getReadLstatFailure(t, genericError)
const mockedRead = getReadStatFailure(t, genericError)

t.notOk(
mockedRead.hasContent.sync(CACHE, 'sha1-deadbeef sha1-13371337'),
Expand Down

0 comments on commit d586a5a

Please sign in to comment.