Skip to content

Instantly share code, notes, and snippets.

@jamal-abbasi
jamal-abbasi / autocannon.js
Created July 31, 2022 08:36
Autocannon script used to stress tests the api's with clinicjs to see the quality issues in code
'use strict'
const autocannon = require('autocannon')
function startBench() {
const url = 'http://localhost:10105';
autocannon({
url,
connections: 10, //default
pipelining: 1, // default
@jamal-abbasi
jamal-abbasi / account-type.resolver.ts
Created July 31, 2022 08:55
Unit Testing GraphQL resolver in nest.js
import { Resolver, Query, Args, Mutation } from '@nestjs/graphql';
import { KeyValInput } from '@common/inputs/key-val.input';
import { CurrentUser, Fields } from '@common/decorators';
import { ICurrentUser } from '@common/interfaces';
import { AccountTypeService } from '@app/v1/account-type/account-type.service';
import { AccountType, AccountTypeWithPagination } from '@app/v1/account-type/account-type.model';
import { AccountTypeFilterParams, AccountTypeUpdateDto, ApproveAccountTypeInput } from './account-type.dto';
import { PaginationParams, SortingParam } from '@rubix/common';
@jamal-abbasi
jamal-abbasi / App.test.tsx
Created July 31, 2022 09:03
Unit Testing React Application Sample Test
import React from 'react';
import { render } from '@testing-library/react';
import App from './App';
test('renders react link', () => {
const { getByText } = render(<App />);
const linkElement = getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});