Skip to content

Instantly share code, notes, and snippets.

View Julianhm9612's full-sized avatar
💭
Make it happen!

Julian Henao Marin Julianhm9612

💭
Make it happen!
View GitHub Profile
@Julianhm9612
Julianhm9612 / index.test.tsx
Last active February 5, 2024 21:52
Jest - Mock custom hook
// Method 1
const mockData = {
something: 'value'
};
const mockUseSomething = jest.fn().mockReturnValue({
data: mockData,
isLoading: false,
isSuccess: true,
refetch: () => mockUseSomething
@Julianhm9612
Julianhm9612 / index.js
Created February 6, 2025 15:18
Timer in minutes
$scope.counter = angular.copy($scope.datos.tiempoExpiracion * 60000);
function countdown() {
$scope.onTimeout = function () {
if ($scope.counter > 0) {
$scope.counter -= 1000;
const minutes = Math.floor(($scope.counter / 1000 / 60) % 60);
const seconds = Math.floor(($scope.counter / 1000) % 60);