Skip to content

Commit

Permalink
wip: perf code style
Browse files Browse the repository at this point in the history
  • Loading branch information
ipcjs committed Apr 8, 2024
1 parent d322217 commit 09f2dc5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,20 @@ describe('SetFileDates', () => {
});
it('set to created time if no updated field in note', () => {
notes['note']['updated'] = undefined;
const { birthtime: oldBirthtime } = fs.statSync('./test/data/test-justText.enex')
const { birthtime: oldBirthtime } = fs.statSync('./test/data/test-justText.enex');
utils.setFileDates('./test/data/test-justText.enex', notes['note']['created'], notes['note']['updated']);
const fStat = fs.statSync('./test/data/test-justText.enex');
const created = moment(notes['note']['created']).valueOf()
const created = moment(notes['note']['created']).valueOf();

const btime = fStat.birthtime.valueOf()
const btime = fStat.birthtime.valueOf();
const atime = fStat.atime.valueOf();
const mtime = fStat.mtime.valueOf();

// Linux does not support setting btime, so btime maybe equal to previous value
// see: https://www.npmjs.com/package/utimes#caveats
assert.ok(btime === created || btime === oldBirthtime.valueOf())
assert.equal(atime, created)
assert.equal(mtime, created)
assert.ok(btime === created || btime === oldBirthtime.valueOf());
assert.equal(atime, created);
assert.equal(mtime, created);
});
});

Expand Down

0 comments on commit 09f2dc5

Please sign in to comment.