-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #108 from zanerock/work-liquid-labs/cloudsite/107
Rework user output and remove dependency on process.stdout
- Loading branch information
Showing
28 changed files
with
177 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 11 additions & 13 deletions
24
src/cli/lib/configuration/test/handle-configuration-show.test.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,23 @@ | ||
import { StringOut } from 'magic-print' | ||
|
||
import { configureLogger } from '../../../../lib/shared/progress-logger' | ||
import { handleConfigurationShow } from '../handle-configuration-show' | ||
|
||
const expectedOutput = 'hi' | ||
const settingsVal = 'hi' | ||
|
||
jest.mock('node:fs/promises', () => ({ | ||
readFile : () => expectedOutput | ||
readFile : () => settingsVal | ||
})) | ||
|
||
describe('handleConfigurationShow', () => { | ||
let output | ||
let origWrite | ||
beforeAll(() => { | ||
origWrite = process.stdout.write | ||
process.stdout.write = (chunk) => { output = chunk } | ||
}) | ||
|
||
afterAll(() => { | ||
process.stdout.write = origWrite | ||
let stringOut | ||
beforeEach(() => { | ||
stringOut = new StringOut() | ||
configureLogger({ out : stringOut }) | ||
}) | ||
|
||
test('prints the file contents', async () => { | ||
await handleConfigurationShow({ argv : [], db : { account : { settings : expectedOutput } } }) | ||
expect(output).toBe(expectedOutput + '\n') | ||
await handleConfigurationShow({ argv : [], db : { account : { settings : settingsVal } } }) | ||
expect(stringOut.string).toBe(settingsVal + '\n') | ||
}) | ||
}) |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.