-
-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(log-feature): Variable getting its value from a function call
- Loading branch information
1 parent
85338e6
commit 2d7d212
Showing
8 changed files
with
107 additions
and
19 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
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
22 changes: 22 additions & 0 deletions
22
src/test/files/js/log-feature/variable/valueFromFunctionCall.ts
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// @ts-nocheck | ||
|
||
export function useUserSettings() { | ||
const currencies = useQuery({ | ||
enabled: false, | ||
queryFn: () => sdk.unified.getCurrencies(), | ||
queryKey: ['settings', 'currencies'], | ||
}); | ||
const setCurrentCurrency = (value: string) => { | ||
setCookie(CURRENCY_COOKIE, value, { | ||
sameSite: 'strict', | ||
secure: true, | ||
}); | ||
currencies.refetch(); | ||
queryClient.removeQueries({ | ||
queryKey: ['lazyProduct'], | ||
type: 'active', | ||
}); | ||
setCurrency(value); | ||
}; | ||
return { setCurrentCurrency, setCurrentLocale }; | ||
} |
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
58 changes: 58 additions & 0 deletions
58
src/test/integration/js/log-feature/variable/valueFromFunctionCall.ts
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 |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import * as vscode from 'vscode'; | ||
import Mocha, { it, describe } from 'mocha'; | ||
import { expect } from 'chai'; | ||
import { | ||
openDocument, | ||
expectActiveTextEditorWithFile, | ||
documentLinesChanged, | ||
NaturalEditorPosition, | ||
naturalEditorLine, | ||
} from '../../../helpers'; | ||
import { ProgrammingLanguage } from '../../../../../entities'; | ||
|
||
export default (): void => { | ||
describe('Variable getting its value from a function call', () => { | ||
Mocha.before(async () => { | ||
await openDocument( | ||
ProgrammingLanguage.JAVASCRIPT, | ||
'log-feature/variable', | ||
'valueFromFunctionCall.ts', | ||
); | ||
}); | ||
Mocha.after(async () => { | ||
await vscode.commands.executeCommand( | ||
'workbench.action.closeActiveEditor', | ||
[], | ||
); | ||
}); | ||
it('Case 1', async () => { | ||
const { activeTextEditor } = vscode.window; | ||
expectActiveTextEditorWithFile( | ||
activeTextEditor, | ||
'valueFromFunctionCall.ts', | ||
); | ||
if (activeTextEditor) { | ||
activeTextEditor.selections = [ | ||
new vscode.Selection( | ||
new NaturalEditorPosition(4, 9), | ||
new NaturalEditorPosition(4, 19), | ||
), | ||
]; | ||
await vscode.commands.executeCommand( | ||
'turboConsoleLog.displayLogMessage', | ||
[], | ||
); | ||
await Promise.all( | ||
documentLinesChanged(activeTextEditor.document, [ | ||
naturalEditorLine(9), | ||
]), | ||
); | ||
expect( | ||
/console\.log\(.*/.test( | ||
activeTextEditor.document.lineAt(naturalEditorLine(9)).text, | ||
), | ||
).to.equal(true); | ||
} | ||
}); | ||
}); | ||
}; |