-
-
Notifications
You must be signed in to change notification settings - Fork 216
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 #7517 from qmonmert/sinonvsvitest
Replace sinon by vitest in tests files (generated Vue app)
- Loading branch information
Showing
1 changed file
with
4 additions
and
7 deletions.
There are no files selected for viewing
11 changes: 4 additions & 7 deletions
11
.../resources/generator/client/vue/test/spec/common/secondary/ConsoleLogger.spec.ts.mustache
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,21 +1,18 @@ | ||
import { describe, it, expect } from 'vitest'; | ||
import sinon from 'sinon'; | ||
import { describe, it, expect, vi } from 'vitest'; | ||
|
||
import ConsoleLogger from '@/common/secondary/ConsoleLogger'; | ||
|
||
describe('ConsoleLogger', () => { | ||
it('should log an error', () => { | ||
const logger = { | ||
error: sinon.stub(), | ||
error: vi.fn(), | ||
}; | ||
const consoleLogger = new ConsoleLogger(logger as any); | ||
const error = new Error('Error message'); | ||
|
||
consoleLogger.error('An error occurs', error); | ||
|
||
const [message, errorPassed] = logger.error.getCall(0).args; | ||
expect(message).toBe('An error occurs\n'); | ||
expect(errorPassed).toBeInstanceOf(Error); | ||
expect(errorPassed.message).toBe('Error message'); | ||
expect(logger.error).toHaveBeenCalledTimes(1); | ||
expect(logger.error).toBeCalledWith('An error occurs\n', error); | ||
}); | ||
}); |