Skip to content

Instantly share code, notes, and snippets.

View ddialar's full-sized avatar

Dailos Rafael Díaz Lara ddialar

View GitHub Profile
import { orm } from '@orm';
// Other needed imports and operations...
describe('Block description', () => {
// Type error restoring the mock (mocking strategy #1)...
test('whatever test description.', async (done) => {
// Creating the spyOn...
jest.spyOn(orm.controllers, 'enableUserAccount')
// Mocking the function...
orm.controllers.enableUserAccount = jest
import logger from '@logger';
import {
Resolver,
Query,
Arg
} from 'type-graphql';
import Recipe from './recipe-type';
import log4js from 'log4js';
var loggerConfiguration = {
appenders: {
console: {
type: 'console',
layout: {
type: 'pattern',
pattern: '[%r] (%35.35c) - [%[%5.5p%]] - %m%'
}
@ddialar
ddialar / phone.number.type.js
Created May 3, 2018 06:22
Phone Number type definition for GraphQL back-end.
import {
GraphQLObjectType,
GraphQLInputObjectType,
GraphQLString,
GraphQLNonNull
} from 'graphql';
var ObjectType = new GraphQLObjectType({
name: 'PhoneNumber',
fields: () => ({
@ddialar
ddialar / 01_motor_servo.ino
Last active February 15, 2018 06:36
Control de giro de un servo motor mediante el uso de librerías
/*
* TALLER DE ROBÓTICA Y PROGRAMACIÓN
* Día Mundial de la Mujer y la Niña en la Ciencia
* Colegio Salesiano San Juan Bosco de La Cuesta
* Febrero 2018
*
* Uso de librerías para movel un motor servo.
*/
#include <Servo.h> // Incluimos la librería "Servo".
@ddialar
ddialar / 01_conversor_analogico_digital_un_led.ino
Created February 15, 2018 06:18
Código de ejemplo para el uso del convertidor analógico/digital con Arduino
/*
* TALLER DE ROBÓTICA Y PROGRAMACIÓN
* Día Mundial de la Mujer y la Niña en la Ciencia
* Colegio Salesiano San Juan Bosco de La Cuesta
* Febrero 2018
*
* Detección de nivel de voltaje analógico y conversión
* digital del mismo.
*/
#include <Servo.h>
Servo servoDelantero;
Servo servoTrasero;
int pinServoDelantero = 5;
int pinServoTrasero = 6;
int posicionDelante = 45;
int posicionDetras = 135;
import 'jest';
import * as graphql from 'graphql';
import UserType from '../../../src/graphql/models/user.type';
import * as PhoneNumberType from '../../../src/graphql/models/phone.number.type';
import * as EmailAddressType from '../../../src/graphql/models/email.address.type';
import TimestampType from '../../../src/graphql/custom-types/timestamp.type';
describe('Testing UserType ...', () => {
test('Fields integrity.', () => {
import 'jest';
import * as graphql from 'graphql';
import * as EmailAddressType from '../../../src/graphql/models/email.address.type';
describe('Testing EmailAddressType ...', () => {
test('fields integrity when it is used as \'ObjectType\'.', () => {
let emailAddressFields = EmailAddressType.ObjectType.getFields();
expect(emailAddressFields).toHaveProperty('email');
expect(emailAddressFields.email.type).toMatchObject(new graphql.GraphQLNonNull(graphql.GraphQLString));
import 'jest';
import * as graphql from 'graphql';
import * as PhoneNumberType from '../../../src/graphql/models/phone.number.type';
describe('Testing PhoneNumberType ...', () => {
test('fields integrity when it is used as \'ObjectType\'.', () => {
let phoneNumberFields = PhoneNumberType.ObjectType.getFields();
expect(phoneNumberFields).toHaveProperty('number');
expect(phoneNumberFields.number.type).toMatchObject(new graphql.GraphQLNonNull(graphql.GraphQLString));