-
-
Notifications
You must be signed in to change notification settings - Fork 5k
Unit tests for displayPath function #5676
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -4,7 +4,7 @@ import Promise from 'bluebird'; | |||
| import { magenta } from 'picocolors'; | ||||
| import type Hexo from './index'; | ||||
|
|
||||
| export = (ctx: Hexo): Promise<void[][]> => { | ||||
| export default function loadPlugins(ctx: Hexo): Promise<void[][]> { | ||||
| if (!ctx.env.init || ctx.env.safe) return; | ||||
|
|
||||
| return loadModules(ctx).then(() => loadScripts(ctx)); | ||||
|
|
@@ -77,6 +77,7 @@ function loadScripts(ctx: Hexo): Promise<void[][]> { | |||
| })); | ||||
| } | ||||
|
|
||||
| function displayPath(path: string, baseDirLength: number): string { | ||||
| //EXPORTING displayPath FUNCTION FOR TESTING | ||||
|
||||
| //EXPORTING displayPath FUNCTION FOR TESTING |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,37 @@ | ||||||
| //NEW UNIT TEST FOR displayPath FUNCTION | ||||||
|
||||||
| //NEW UNIT TEST FOR displayPath FUNCTION | |
| // Unit tests for the displayPath function |
Copilot
AI
Jul 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The should variable is declared but never used. The tests use result.should.equal() which works through chai's extension of Object.prototype.
| const should = chai.should(); | |
| // Removed unused `should` variable declaration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing from CommonJS
export =to ES modulesexport defaultis a breaking change that affects all existing imports. Consider keeping the original export pattern or creating a separate utility module for testable functions.