repo_name
stringlengths
5
122
path
stringlengths
3
232
text
stringlengths
6
1.05M
jplippi/xivanalysis
src/parser/jobs/blm/changelog.tsx
import CONTRIBUTORS from 'data/CONTRIBUTORS' import React from 'react' export const changelog = [ // { // date: new Date('2021-11-19'), // Changes: () => <>The changes you made</>, // contrubutors: [CONTRIBUTORS.YOU], // }, { date: new Date('2021-11-04'), Changes: () => <>Initial data scaffolding and basi...
jplippi/xivanalysis
src/data/ACTIONS/layers/index.ts
import {Layer} from 'data/layer' import {ActionRoot} from '../root' export const layers: Array<Layer<ActionRoot>> = [ // Layers should be in their own files, and imported for use here. // Example layer: // {patch: '5.05', data: {ATTACK: {id: 9001}}}, ]
jplippi/xivanalysis
src/parser/jobs/nin/modules/TrickAttackWindow.tsx
<gh_stars>1-10 import {t} from '@lingui/macro' import {Trans, Plural} from '@lingui/react' import {ActionLink} from 'components/ui/DbLink' import {ActionKey} from 'data/ACTIONS' import {dependency} from 'parser/core/Injectable' import {BuffWindow, EvaluatedAction, ExpectedActionsEvaluator, ExpectedGcdCountEvaluator, Li...
jplippi/xivanalysis
src/parser/jobs/smn/modules/Summons.tsx
import {t} from '@lingui/macro' import {Plural, Trans} from '@lingui/react' import {ActionLink} from 'components/ui/DbLink' import {ActionKey} from 'data/ACTIONS' import {Event, Events} from 'event' import {Analyser} from 'parser/core/Analyser' import {filter, noneOf, oneOf} from 'parser/core/filter' import {dependency...
jplippi/xivanalysis
src/parser/jobs/ast/modules/Tincture.tsx
<reponame>jplippi/xivanalysis<gh_stars>0 import {Trans} from '@lingui/react' import {DataLink} from 'components/ui/DbLink' import {ExpectedActionsEvaluator} from 'parser/core/modules/ActionWindow' import {SEVERITY} from 'parser/core/modules/Suggestions' import {Tincture as CoreTincture} from 'parser/core/modules/Tinctu...
jplippi/xivanalysis
src/parser/core/modules/ActionWindow/History.ts
import _ from 'lodash' export interface HistoryEntry<T> { /** * The timestamp at which the entry started. */ start: number /** * The timestamp at which the entry ended or undefined if the entry is open. */ end?: number /** * The data for this entry. */ data: T } export class History<T> { /** * C...
jplippi/xivanalysis
src/data/ACTIONS/root/MNK.ts
<gh_stars>1-10 import {Attribute} from 'event' import {ensureActions} from '../type' export const MNK = ensureActions({ // ----- // Player GCDs // ----- BOOTSHINE: { id: 53, name: 'Bootshine', icon: 'https://xivapi.com/i/000000/000208.png', onGcd: true, speedAttribute: Attribute.SKILL_SPEED, }, TRUE_...
jplippi/xivanalysis
src/parser/jobs/mnk/modules/constants.ts
<gh_stars>1-10 import {ActionKey} from 'data/ACTIONS' import {StatusKey} from 'data/STATUSES' // Forms export const FORM_TIMEOUT_MILLIS = 30000 export const FORMS: StatusKey[] = [ 'OPO_OPO_FORM', 'RAPTOR_FORM', 'COEURL_FORM', ] export const OPO_OPO_SKILLS: ActionKey[] = [ 'BOOTSHINE', 'DRAGON_KICK', 'SHADOW_OF...
jplippi/xivanalysis
src/data/STATUSES/layers/index.ts
<gh_stars>100-1000 import {Layer} from 'data/layer' import {StatusRoot} from '../root' export const layers: Array<Layer<StatusRoot>> = [ // Layers should be in their own files, and imported for use here. // Example layer: // {patch: '5.05', data: {BIO_II: {id: 9001}}}} ]
jplippi/xivanalysis
src/parser/jobs/mnk/modules/Forms.tsx
<reponame>jplippi/xivanalysis import {Plural, Trans} from '@lingui/react' import {DataLink} from 'components/ui/DbLink' import {Action} from 'data/ACTIONS' import {Status} from 'data/STATUSES' import {Event, Events} from 'event' import {Analyser} from 'parser/core/Analyser' import {EventHook} from 'parser/core/Dispatch...
jplippi/xivanalysis
src/parser/jobs/sch/modules/CooldownDowntime.tsx
import {CooldownDowntime as CooldownDowntimeCore} from 'parser/core/modules/CooldownDowntime' export class CooldownDowntime extends CooldownDowntimeCore { override trackedCds = [ { cooldowns: [this.data.actions.CHAIN_STRATAGEM], firstUseOffset: 10000, }, { cooldowns: [this.data.actions.AETHERFLOW], ...
jplippi/xivanalysis
src/parser/core/modules/RaidBuffs.ts
<reponame>jplippi/xivanalysis<filename>src/parser/core/modules/RaidBuffs.ts<gh_stars>100-1000 import {JobKey} from 'data/JOBS' import {Status, StatusKey} from 'data/STATUSES' import {Event, Events} from 'event' import {Team} from 'report' import {Analyser} from '../Analyser' import {filter, oneOf} from '../filter' impo...
jplippi/xivanalysis
src/parser/core/modules/ActionWindow/index.ts
export type {EvaluatedAction} from './EvaluatedAction' export type {AllowedGcdsOnlyOptions} from './evaluators/AllowedGcdsOnlyEvaluator' export {AllowedGcdsOnlyEvaluator} from './evaluators/AllowedGcdsOnlyEvaluator' export {ExpectedActionsEvaluator} from './evaluators/ExpectedActionsEvaluator' export {ExpectedActionGr...
jplippi/xivanalysis
src/parser/jobs/rdm/modules/Embolden.tsx
<gh_stars>100-1000 import {t} from '@lingui/macro' import {Trans} from '@lingui/react' import {RotationTable} from 'components/ui/RotationTable' import {Event, Events} from 'event' import _ from 'lodash' import {Analyser} from 'parser/core/Analyser' import {filter, oneOf} from 'parser/core/filter' import {dependency} f...
jplippi/xivanalysis
src/parser/jobs/dnc/modules/Gauge.tsx
<filename>src/parser/jobs/dnc/modules/Gauge.tsx import {Plural, Trans} from '@lingui/react' import Color from 'color' import {DataLink} from 'components/ui/DbLink' import {ActionKey} from 'data/ACTIONS' import {JOBS} from 'data/JOBS' import {StatusKey} from 'data/STATUSES' import {Event, Events} from 'event' import {Ev...
jplippi/xivanalysis
src/parser/core/modules/ActionWindow/windows/BuffWindow.ts
<filename>src/parser/core/modules/ActionWindow/windows/BuffWindow.ts import {Status} from 'data/STATUSES' import {Event, Events} from 'event' import _ from 'lodash' import {TimestampHook, TimestampHookArguments} from 'parser/core/Dispatcher' import {ensureArray} from 'utilities' import {filter, oneOf} from '../../../fi...
jplippi/xivanalysis
src/parser/jobs/mnk/changelog.tsx
<reponame>jplippi/xivanalysis import CONTRIBUTORS from 'data/CONTRIBUTORS' import React from 'react' export const changelog = [ { date: new Date('2022-01-03'), Changes: () => <>Update Twin Snakes buff description, and adjust timeline order.</>, contributors: [CONTRIBUTORS.AY], }, { date: new Date('2022-01-0...
jplippi/xivanalysis
src/parser/jobs/drg/index.tsx
<reponame>jplippi/xivanalysis import {Trans} from '@lingui/react' import CONTRIBUTORS, {ROLES} from 'data/CONTRIBUTORS' import {Meta} from 'parser/core/Meta' import React from 'react' export const DRAGOON = new Meta({ modules: () => import('./modules' /* webpackChunkName: "jobs-drg" */), Description: () => <> <Tra...
jplippi/xivanalysis
src/parser/jobs/rpr/modules/DISPLAY_ORDER.ts
<reponame>jplippi/xivanalysis export const DISPLAY_ORDER = { INTERRUPTS: 20, IMMORTAL_SACRIFICE: 10, }
jplippi/xivanalysis
src/reportSources/legacyFflogs/eventAdapter/oneHpLock.ts
import {Event, Events} from 'event' import {Actor} from 'report' import {AdapterStep} from './base' /** * FFLogs seems to generate nonsensical actor resource updates on bosses that * "castlock" at 1 HP - It'll show it dropping down to 0 HP (which should be * impossible), then back up to 1, every few seconds. * * ...
jplippi/xivanalysis
src/parser/jobs/drg/modules/BattleLitany.tsx
import {t} from '@lingui/macro' import {Trans} from '@lingui/react' import {ActionLink} from 'components/ui/DbLink' import {Event, Events} from 'event' import {filter} from 'parser/core/filter' import {dependency} from 'parser/core/Injectable' import {BuffWindow, EvaluatedAction, EvaluationOutput, ExpectedGcdCountEvalu...
mcshaz/pdf-lib
apps/deno/tests/test18.ts
<reponame>mcshaz/pdf-lib import fontkit from 'https://cdn.skypack.dev/@pdf-lib/fontkit@^1.0.0?dts'; import { Assets } from '../index.ts'; // @deno-types="../dummy.d.ts" import { PDFDocument } from '../../../dist/pdf-lib.esm.js'; // Based on test14.ts const loadA = async (assets: Assets) => { const pdfDoc = await P...
ChocolateUI/chocolate-hooks
src/hooks/useCookie/index.tsx
import { useCallback, useState } from 'react' import Cookies from 'js-cookie' const useCookie = ( cookieName: string, ): [ string | null, (newValue: string, options?: Cookies.CookieAttributes) => void, () => void, ] => { const [value, setValue] = useState<string | null>( () => Cookies.get(cookieName) || ...
ChocolateUI/chocolate-hooks
src/hooks/useSetState/index.tsx
<filename>src/hooks/useSetState/index.tsx import { useCallback, useState } from 'react' export function isFunction(obj: any): obj is Function { return typeof obj === 'function' } /** * 像 class 组件 中 this.setState 一样丝滑 * @param initialState * @returns */ const useSetState = <T extends object>( initialState: T =...
ChocolateUI/chocolate-hooks
src/hooks/useCountDown/index.tsx
<filename>src/hooks/useCountDown/index.tsx /* eslint-disable react-hooks/exhaustive-deps */ import { useEffect, useRef, useCallback } from 'react' import { exchangeKey } from '../../utils/function' import useSetState from '../useSetState' /** * 倒计时 hooks,支持毫秒级 * 当 diff 小于 16.6ms ≈ 17ms 时直接使用 raf,由浏览器调度 * * 使用方法: ...
ChocolateUI/chocolate-hooks
src/utils/function.ts
export const isFunction = (value: any) => { return typeof value === 'function' || value instanceof Function } export const exchangeKey = (key: string): string => { switch (key) { case 'd+': return 'days' case 'h+': return 'hours' case 'm+': return 'minutes' case 's+': return...
ChocolateUI/chocolate-hooks
src/index.tsx
<filename>src/index.tsx<gh_stars>1-10 export * from './context' export { default as useLeavePrompt } from './hooks/useLeavePrompt' export { default as useSearchParams } from './hooks/useSearchParams' export { default as useCookie } from './hooks/useCookie' export { default as useCountDown } from './hooks/useCountDown' ...
ChocolateUI/chocolate-hooks
src/hooks/useCountDown/index.interface.ts
declare interface Window { webkitRequestAnimationFrame(callback: FrameRequestCallback): number }
ChocolateUI/chocolate-hooks
src/hooks/useSearchParams/index.interface.ts
<filename>src/hooks/useSearchParams/index.interface.ts export interface UseSearchParamsOptions { schema: UseSearchParamsSchema pathname?: string } export interface UseSearchParamsSchema { [key: string]: UseSearchParamsSchemaDetail | string } export interface UseSearchParamsSchemaDetail { type: string default...
yuri-martins/menu-ionic
menu-css/src/app/menu/menu.component.ts
<gh_stars>0 import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-menu', templateUrl: './menu.component.html', styleUrls: ['./menu.component.scss'], }) export class MenuComponent implements OnInit { active: number = 1; menuOpened: boolean = false; constructor() { } ngOnInit() ...
dslosky-usgs/ngx-charts
src/bubble-chart/bubble-chart.module.ts
import { NgModule } from '@angular/core'; import { ChartCommonModule } from '../common/chart-common.module'; import { BubbleChartComponent } from './bubble-chart.component'; import { BubbleSeriesComponent } from './bubble-series.component'; import { LineChartModule } from '../line-chart/line-chart.module'; export { Bu...
ongw20/git-head-info
src/__tests__/index.spec.ts
<filename>src/__tests__/index.spec.ts<gh_stars>0 import gitHeadInfo from '../index' describe('Get git info function should be correctly exported', () => { test('gitInfo should be function type', () => { expect(typeof gitHeadInfo).toBe('function') }) })
ongw20/git-head-info
src/lib/__tests__/index.spec.ts
<filename>src/lib/__tests__/index.spec.ts import path from 'path' import gitHeadInfo from '../index' import { changeGitFolder } from '../utils' const ROOT = process.cwd() const REPO = path.join(ROOT, 'fixtures') describe('Get current repo git head info without param', () => { beforeAll(() => changeGitFolder('.git')...
ongw20/git-head-info
src/lib/__tests__/utils.spec.ts
<gh_stars>0 import { GIT_INFO_FOLDER, changeGitFolder } from '../utils' describe('Can change git folder', () => { test('should correctly change GIT_DIR', () => { expect(GIT_INFO_FOLDER).toBe('.git') changeGitFolder('new/git/dir') expect(GIT_INFO_FOLDER).toBe('new/git/dir') }) })
ongw20/git-head-info
src/index.ts
import gitHeadInfo from './lib' export = gitHeadInfo
ongw20/git-head-info
src/lib/utils.ts
<reponame>ongw20/git-head-info<filename>src/lib/utils.ts<gh_stars>0 // this is used for testing export let GIT_INFO_FOLDER = '.git' export function changeGitFolder(dir: string): void { GIT_INFO_FOLDER = dir }
ongw20/git-head-info
src/lib/index.ts
<reponame>ongw20/git-head-info import fs from 'fs-extra' import path from 'path' import { GIT_INFO_FOLDER } from './utils' interface GitInfo { repo: string sha: string branch?: string } /** * @param {path} repo the git repo to get HEAD info * @returns {Promise<GitInfo>} */ export default async function gitHea...
MarazorQ/ATM-SERVER
src/deposit/dto/create-accounts.dto.ts
export class CreateAccountsDto { readonly number: string; readonly code: number; readonly activity: string; readonly type: string; readonly money: number; readonly name: string; }
MarazorQ/ATM-SERVER
src/credit/credit.controller.ts
<gh_stars>0 import { Controller, Get, Post, Body } from '@nestjs/common'; import { CreditService } from './credit.service'; import { CreateCreditPlanDto } from './dto/crate-credit-plan.dto'; @Controller('credit') export class CreditController { constructor(private creditService: CreditService) {} @Post('types') ...
MarazorQ/ATM-SERVER
src/credit/credit.module.ts
<filename>src/credit/credit.module.ts import { Module } from '@nestjs/common'; import { SequelizeModule } from '@nestjs/sequelize'; import { CreditController } from './credit.controller'; import { CreditService } from './credit.service'; import { CreditTypes, CreditPlan } from './credit.model'; import { Accounts } from...
MarazorQ/ATM-SERVER
src/deposit/deposit.controller.ts
<reponame>MarazorQ/ATM-SERVER import { Controller, Get, Post, Body } from '@nestjs/common'; import { DepositService } from './deposit.service'; import { CreateAccountsDto } from './dto/create-accounts.dto'; import { CreateDepositPlanDto } from './dto/crate-deposit-plan.dto'; @Controller('deposit') export class DepositC...
MarazorQ/ATM-SERVER
src/deposit/dto/crate-deposit-plan.dto.ts
export class CreateDepositPlanDto { readonly deposit_type_id: number; readonly client_id: number; readonly amount: number; readonly name: string; }
MarazorQ/ATM-SERVER
src/clients/dto/create-city.dto.ts
<filename>src/clients/dto/create-city.dto.ts export class CreateCityDto { readonly name: string; }
MarazorQ/ATM-SERVER
src/deposit/deposit.service.ts
<filename>src/deposit/deposit.service.ts import { Injectable, HttpException, HttpStatus } from '@nestjs/common'; import { InjectModel } from '@nestjs/sequelize'; import { Op } from 'sequelize'; import { Currency, DepositTypes, Accounts, DepositPlan, } from './deposit.models'; import { CreateAccountsDto } from '...
MarazorQ/ATM-SERVER
src/clients/clients.module.ts
import { Module } from '@nestjs/common'; import { ClientsController } from './clients.controller'; import { ClientsService } from './clients.service'; import { SequelizeModule } from '@nestjs/sequelize'; import { Citys, Disabitilitys, MaterialStatus, Сitizenship, Clients, } from './clients.models'; @Module({...
MarazorQ/ATM-SERVER
src/credit/dto/crate-credit-plan.dto.ts
export class CreateCreditPlanDto { readonly credit_type_id: number; readonly client_id: number; readonly amount: number; readonly name: string; }
MarazorQ/ATM-SERVER
src/clients/dto/create-clients.dto.ts
<gh_stars>0 export class CreateClientsDto { id?: number; readonly first_name: string; readonly last_name: string; readonly third_name: string; readonly date_born: string; readonly sex: string; readonly passport_series: string; readonly passport_id: string; readonly who_issued_the_passport: string; r...
MarazorQ/ATM-SERVER
src/app.module.ts
import { Module } from '@nestjs/common'; import { SequelizeModule } from '@nestjs/sequelize'; import { ConfigModule } from '@nestjs/config'; import { ClientsModule } from './clients/clients.module'; import { Citys, Disabitilitys, MaterialStatus, Сitizenship, Clients, } from './clients/clients.models'; import ...
MarazorQ/ATM-SERVER
src/clients/clients.controller.ts
<reponame>MarazorQ/ATM-SERVER<gh_stars>0 import { Controller, Post, Get, Body, Delete, Put } from '@nestjs/common'; import { CreateCityDto } from './dto/create-city.dto'; import { CreateDisabilityDto } from './dto/create-disabitility.dto'; import { CreateMaterialStatusDto } from './dto/create-material-status.dto'; impo...
MarazorQ/ATM-SERVER
src/credit/helper/index.ts
<reponame>MarazorQ/ATM-SERVER export const isDolzen = ( days: number, amount: number, payed: number, daycount: number, ) => { const credMonth = Math.round(days / 30); const credBody = amount / credMonth; const payment = []; for (let i = 0; i <= credMonth; i++) { payment.push( Math.round((((am...
MarazorQ/ATM-SERVER
src/clients/clients.models.ts
<gh_stars>0 import { Column, DataType, Model, Table } from 'sequelize-typescript'; interface CitysCreationsAttr { name: string; } interface DisabitilitysCreationsAttr { name: string; } interface MaterialStatusCreationsAttr { name: string; } interface СitizenshipStatusCreationsAttr { name: string; } interface C...
MarazorQ/ATM-SERVER
src/deposit/deposit.models.ts
import { Column, DataType, Model, Table, BelongsTo, HasOne, } from 'sequelize-typescript'; interface CurrencyCreationsAttr { name: string; } interface DepositTypesCreationsAttr { name: string; } interface AccountsTypesCreationsAttr { number: string; code: number; activity: string; type: string;...
MarazorQ/ATM-SERVER
src/credit/credit.service.ts
import { Injectable } from '@nestjs/common'; import { InjectModel } from '@nestjs/sequelize'; import { v4 as uuidv4 } from 'uuid'; import { CreditTypes, CreditPlan } from './credit.model'; import { Accounts } from '../deposit/deposit.models'; import { CreateCreditPlanDto } from './dto/crate-credit-plan.dto'; import { i...
MarazorQ/ATM-SERVER
src/deposit/deposit.module.ts
<filename>src/deposit/deposit.module.ts import { Module } from '@nestjs/common'; import { SequelizeModule } from '@nestjs/sequelize'; import { Currency, DepositTypes, Accounts, DepositPlan, } from './deposit.models'; import { DepositController } from './deposit.controller'; import { DepositService } from './dep...
MarazorQ/ATM-SERVER
src/credit/credit.model.ts
import { Column, DataType, Model, Table, BelongsTo, HasOne, } from 'sequelize-typescript'; interface CreditTypesCreationsAttr { name: string; } interface CreditPlanTypesCreationsAttr { client_id: number; credit_type_id: number; end_date: Date; amount: number; payed: number; acc_id_repay: numb...
MarazorQ/ATM-SERVER
src/clients/clients.service.ts
<reponame>MarazorQ/ATM-SERVER import { Injectable, HttpException, HttpStatus } from '@nestjs/common'; import { InjectModel } from '@nestjs/sequelize'; import { Citys, Disabitilitys, MaterialStatus, Сitizenship, Clients, } from './clients.models'; import { CreateCityDto } from './dto/create-city.dto'; import {...
ashiishme/easy-mail
src/pages/inbox.page.tsx
import React, { useState, useEffect, useContext } from 'react'; import { FlexRow } from 'ui/flex'; import MainLayout from 'ui/main.layout'; import { AuthContext } from 'app/app.context'; import { MailResponse, Email } from 'api/api.type'; import { getMails, listenIncomingMails } from 'api/request.api'; import Email...
ashiishme/easy-mail
src/pages/home.page.tsx
<filename>src/pages/home.page.tsx import { Link } from 'react-router-dom'; import React, { useContext } from 'react'; import MainLayout from 'ui/main.layout'; import { ROUTE } from 'app/app.route-path'; import { AuthContext } from 'app/app.context'; import CreateEmail from './components/create-email.component'; cons...
ashiishme/easy-mail
src/api/request.api.ts
import apiClient from './graphql.api'; export const listenIncomingMails = (username: string) => { return apiClient .request( `{ inbox ( namespace:"${process.env.REACT_APP_TEST_MAIL_NAMESPACE}" tag:"${username}" timestamp_from:${Date.now()} livequery:true ...
ashiishme/easy-mail
src/ui/header.tsx
import { Link } from 'react-router-dom'; import React, { useEffect, useState, useContext, useReducer } from 'react'; import { Flex } from './flex'; import * as app from 'app/app.state'; import { LS_KEY } from 'app/app.constant'; import { ROUTE } from 'app/app.route-path'; import { AuthContext } from 'app/app.context'...
eyalbor/testing_nest_js
src/models/cats/cats.service.ts
<filename>src/models/cats/cats.service.ts // The @Injectable() decorator attaches metadata, which declares that CatsService is a class that can be managed by the Nest IoC container" // Nest IoC container = import { Injectable } from '@nestjs/common'; import { Cat } from './interfaces/cat.interface'; @Injectable() expo...
eyalbor/testing_nest_js
src/common/middlewares/logger.middlewares.ts
import { Request, Response, NextFunction } from 'express'; //Nest middleware fully supports Dependency Injection, is done through the constructor //Consider using the simpler functional middleware alternative any time your middleware doesn't need any dependencies. export function logger(req: Request, res: Response, ne...
eyalbor/testing_nest_js
src/models/cats/cats.controller.ts
import { Controller, Get, HttpCode, Post, Req, Header, HttpStatus, Redirect, Query, Param, Body, ForbiddenException, UseFilters, ParseIntPipe, UseGuards, Delete, } from '@nestjs/common'; import { Request } from 'express'; import { CreateCatDto } from './dto/create-cat.dto'; import { Cats...
eyalbor/testing_nest_js
src/main.ts
<filename>src/main.ts<gh_stars>0 import { NestFactory } from '@nestjs/core'; import { SwaggerModule, DocumentBuilder, SwaggerCustomOptions, } from '@nestjs/swagger'; import { AppModule } from './app.module'; import helmet from 'helmet'; import { logger } from './common/middlewares/logger.middlewares'; async func...
eyalbor/testing_nest_js
src/models/database/database.module.ts
// import { DynamicModule, Module } from '@nestjs/common'; // // @Module({ // providers: [Connection], // }) // export class DatabaseModule { // static forRoot(entities = [], option?): DynamicModule { // const providers = createDatabaseProviders(option, entities); // return { // module: DatabaseModule...
eyalbor/testing_nest_js
src/models/common/common.module.ts
<filename>src/models/common/common.module.ts import { Module } from '@nestjs/common'; import { CommonService } from './common.service'; @Module({ exports: [CommonModule], providers: [CommonService], }) export class CommonModule { //A module class can inject providers as well (e.g., for configuration purposes): ...
eyalbor/testing_nest_js
src/app.module.ts
<gh_stars>0 import { Module } from '@nestjs/common'; import { CatsController } from './models/cats/cats.controller'; import { AdminController } from './models/admin/admin.controller'; import { AccountController } from './models/account/account.controller'; import { CatsModule } from './models/cats/cats.module'; import ...
eyalbor/testing_nest_js
src/models/core/core.module.ts
<filename>src/models/core/core.module.ts import { Global, Module } from '@nestjs/common'; import { CommonModule } from '../common/common.module'; // re-export modules that they import // However, module classes themselves cannot be injected as providers due to circular dependency . // When you want to provide a set ...
l00pinfinity/github-search
src/app/search/search.component.ts
import { Component, OnInit } from '@angular/core'; import { SearchService } from "../search.service"; @Component({ selector: 'app-search', templateUrl: './search.component.html', styleUrls: ['./search.component.css'] }) export class SearchComponent implements OnInit { public userQuery!:string; public userQu...
l00pinfinity/github-search
src/app/search.service.ts
<gh_stars>1-10 import { Injectable } from '@angular/core'; import { HttpClient, HttpErrorResponse } from "@angular/common/http"; import { Observable, throwError } from 'rxjs'; import { catchError, retry } from "rxjs/operators"; import { ID } from "../environments/environment"; @Injectable({ providedIn: 'root' }) exp...
l00pinfinity/github-search
src/app/app.module.ts
import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; import { NavbarComponent } from "./navbar/navbar.component"; import { AboutComponent } from "./about/about.compon...
l00pinfinity/github-search
src/app/user.ts
export class User { constructor(public login: string, public avatar_url:string, public public_repos:number, public html_url: string, public created_at:Date, public followers:number, public following:number){ } }
l00pinfinity/github-search
src/app/search-profile/search-profile.component.ts
<reponame>l00pinfinity/github-search<gh_stars>1-10 import { Component, Input, OnInit } from '@angular/core'; @Component({ selector: 'app-search-profile', templateUrl: './search-profile.component.html', styleUrls: ['./search-profile.component.css'] }) export class SearchProfileComponent implements OnInit { @Inp...
asiFarran/FluffySpoon.JavaScript.Testing.Faking
spec/didNotReceive.spec.ts
import test from 'ava'; import { Substitute, Arg } from '../src/index'; import { SubstituteException } from '../src/SubstituteBase'; interface Calculator { add(a: number, b: number): number; subtract(a: number, b: number): number; divide(a: number, b: number): number; isEnabled: boolean; } test('not calling a...
asiFarran/FluffySpoon.JavaScript.Testing.Faking
spec/issues/36.test.ts
import test from 'ava'; import { Substitute, Arg } from '../../src/index'; class Key { private constructor(private _value: string) { } static create() { return new this('123'); } get value(): string { return this._value; } } class IData { private constructor(private _serverChec...
asiFarran/FluffySpoon.JavaScript.Testing.Faking
spec/issues/11.test.ts
<reponame>asiFarran/FluffySpoon.JavaScript.Testing.Faking import test from 'ava'; import { Substitute, Arg } from '../../src/index'; type Addands = { op1: number; op2: number; } class RealCalculator { add(addands: Addands): number { return addands.op1 + addands.op2; } } test('issue 11: arg.is...
asiFarran/FluffySpoon.JavaScript.Testing.Faking
spec/resolves.spec.ts
<filename>spec/resolves.spec.ts import test from 'ava'; import { Substitute, Arg } from '../src'; interface Calculator { getMemory(): Promise<number>; heavyOperation(...args: number[]): Promise<number>; model: Promise<string>; } test('resolves a method with no arguments', async t => { const calculator = Subs...
asiFarran/FluffySpoon.JavaScript.Testing.Faking
spec/Utilities.spec.ts
import test from 'ava'; import { Arg } from '../src'; import { areArgumentArraysEqual } from '../src/Utilities'; const testObject = { "foo": "bar" }; const testArray = ["a", 1, true]; // #90: Infinite recursion in deepEqual https://github.com/ffMathy/FluffySpoon.JavaScript.Testing.Faking/blob/master/spec/issues/90.t...
asiFarran/FluffySpoon.JavaScript.Testing.Faking
src/Arguments.ts
<filename>src/Arguments.ts type PredicateFunction<T> = (arg: T) => boolean type ArgumentOptions = { inverseMatch?: boolean } class BaseArgument<T> { constructor( private _description: string, private _matchingFunction: PredicateFunction<T>, private _options?: ArgumentOptions ...
asiFarran/FluffySpoon.JavaScript.Testing.Faking
src/states/ContextState.ts
import { Context } from "../Context"; export type PropertyKey = string | number | symbol; export interface ContextState { onSwitchedTo?(context: Context): void; apply(context: Context, args: any[]): any; set(context: Context, property: PropertyKey, value: any): void; get(context: Context, prop...
asiFarran/FluffySpoon.JavaScript.Testing.Faking
spec/util/compatibility.ts
export const getCorrectConstructorDescriptor = () => { const nodeVersionLowerThan12 = Number(process.versions.node.split('.')[0]) < 12; return nodeVersionLowerThan12 ? 'Function:' : 'class'; };
asiFarran/FluffySpoon.JavaScript.Testing.Faking
spec/Arguments.spec.ts
import test from 'ava'; import { Arg } from '../src'; import { Argument } from 'src/Arguments'; const testObject = { "foo": "bar" }; const testArray = ["a", 1, true]; const parent = {} as any; parent.child = parent; const root = {} as any; root.path = { to: { nested: root } }; const testFunc = () => { }; test('shoul...
asiFarran/FluffySpoon.JavaScript.Testing.Faking
spec/received.spec.ts
import test from 'ava'; import { Substitute, Arg } from '../src'; import { SubstituteException } from '../src/SubstituteBase'; interface Calculator { add(a: number, b: number): number; multiply(a: number, b?: number): number; isEnabled: boolean; } test('calling a method twice correctly asserts the call count', ...
asiFarran/FluffySpoon.JavaScript.Testing.Faking
src/Utilities.ts
import { Argument, AllArguments } from './Arguments'; import { GetPropertyState } from './states/GetPropertyState'; import { InitialState } from './states/InitialState'; import { Context } from './Context'; import * as util from 'util'; export type Call = any[] // list of args export enum PropertyType { ...
asiFarran/FluffySpoon.JavaScript.Testing.Faking
spec/returns.spec.ts
<filename>spec/returns.spec.ts import test from 'ava'; import { inspect } from 'util' import { Substitute, Arg } from '../src'; import { getCorrectConstructorDescriptor } from './util/compatibility'; interface Calculator { add(a: number, b: number): number; multiply(a: number, b?: number): number; clear(): void...
asiFarran/FluffySpoon.JavaScript.Testing.Faking
spec/issues/59.test.ts
import test from 'ava'; import { Substitute } from '../../src/index'; interface IEcho { echo(a: string): string maybeEcho(a?: string): string } test('issue 59 - Mock function with optional parameters', (t) => { const echoer = Substitute.for<IEcho>() echoer.maybeEcho('foo').returns('bar') echoer.maybeEcho()...
asiFarran/FluffySpoon.JavaScript.Testing.Faking
src/index.ts
import { Substitute, SubstituteOf } from './Substitute'; export { Arg } from './Arguments'; export { Substitute, SubstituteOf }; export default Substitute;
asiFarran/FluffySpoon.JavaScript.Testing.Faking
spec/index.test.ts
import test from 'ava'; import { Substitute, Arg } from '../src'; import { OmitProxyMethods, ObjectSubstitute } from '../src/Transformations'; class Dummy { } export class Example { a = "1337"; c(arg1: string, arg2: string) { return "hello " + arg1 + " world (" + arg2 + ")"; } get d() { r...
asiFarran/FluffySpoon.JavaScript.Testing.Faking
src/Transformations.ts
<filename>src/Transformations.ts<gh_stars>100-1000 import { AllArguments } from "./Arguments"; type FunctionSubstituteWithOverloads<TFunc, Terminating = false> = TFunc extends { (...args: infer A1): infer R1; (...args: infer A2): infer R2; (...args: infer A3): infer R3; (...a...
asiFarran/FluffySpoon.JavaScript.Testing.Faking
spec/rejects.spec.ts
import test from 'ava'; import { Substitute, Arg } from '../src'; interface Calculator { getMemory(): Promise<number>; heavyOperation(...args: number[]): Promise<number>; model: Promise<string>; } test('rejects a method with no arguments', async t => { const calculator = Substitute.for<Calculator>(); calcu...
asiFarran/FluffySpoon.JavaScript.Testing.Faking
spec/issues/45.test.ts
import test from 'ava'; import { Substitute, Arg } from '../../src/index'; class DependencyClass { public methodOne() {} public methodTwo(someArg: string) {} } class SubjectClass { private readonly dependency: DependencyClass; public constructor(dependency: DependencyClass) { this.dependency...
asiFarran/FluffySpoon.JavaScript.Testing.Faking
spec/throws.spec.ts
import test from 'ava' import { Substitute, Arg } from '../src' interface Calculator { add(a: number, b: number): number divide(a: number, b: number): number heavyOperation(): Promise<number> mode: boolean fakeSetting: boolean } test('throws on a method with arguments', t => { const calculator = Substitu...
asiFarran/FluffySpoon.JavaScript.Testing.Faking
src/states/GetPropertyState.ts
<gh_stars>100-1000 import { ContextState, PropertyKey } from './ContextState'; import { Context } from '../Context'; import { PropertyType, SubstituteMethods, Call, areArgumentArraysEqual } from '../Utilities'; import { SubstituteException } from '../SubstituteBase'; interface SubstituteMock { arguments: Call ...
asiFarran/FluffySpoon.JavaScript.Testing.Faking
src/states/InitialState.ts
import { ContextState, PropertyKey } from './ContextState'; import { Context } from '../Context'; import { GetPropertyState } from './GetPropertyState'; import { SetPropertyState } from './SetPropertyState'; import { SubstituteMethods, Call, PropertyType } from '../Utilities'; import { AreProxiesDisabledKey } from...
asiFarran/FluffySpoon.JavaScript.Testing.Faking
src/Context.ts
<gh_stars>100-1000 import { inspect } from 'util' import { ContextState } from './states/ContextState'; import { InitialState } from './states/InitialState'; import { HandlerKey } from './Substitute'; import { PropertyType } from './Utilities'; import { SetPropertyState } from './states/SetPropertyState'; import ...
asiFarran/FluffySpoon.JavaScript.Testing.Faking
src/Substitute.ts
<gh_stars>100-1000 import { Context } from './Context'; import { ObjectSubstitute, OmitProxyMethods, DisabledSubstituteObject } from './Transformations'; export const HandlerKey = Symbol(); export const AreProxiesDisabledKey = Symbol(); export type SubstituteOf<T extends Object> = ObjectSubstitute<OmitProxyMeth...
asiFarran/FluffySpoon.JavaScript.Testing.Faking
spec/issues/23.test.ts
import test from "ava"; import { Substitute, Arg } from "../../src/index"; interface CalculatorInterface { add(a: number, b: number): number; subtract(a: number, b: number): number; divide(a: number, b: number): number; isEnabled: boolean; } test("issue 23: mimick received should not call method", t => { c...
asiFarran/FluffySpoon.JavaScript.Testing.Faking
src/states/SetPropertyState.ts
import { ContextState, PropertyKey } from './ContextState'; import { Context } from '../Context'; import { areArgumentsEqual, PropertyType } from '../Utilities'; import { SubstituteException } from '../SubstituteBase'; export class SetPropertyState implements ContextState { private _callCount: number; private ...
asiFarran/FluffySpoon.JavaScript.Testing.Faking
spec/mimicks.spec.ts
import test from 'ava'; import { Substitute, Arg } from '../src'; interface Calculator { add(a: number, b: number): number; multiply(a: number, b?: number): number; clear(): void; getMemory(): Promise<number>; viewResult(back?: number): number; heavyOperation(...input: number[]): Promise<boolean>; isEnab...
manueljosemt/platzi-store
src/recap.ts
const myName = 'Nicolas'; const myAge = 12; const suma = (a: number, b: number) => { return a + b; }; suma(12, 23); class Persona { /* private age; private name; */ constructor(private age: number, private name: string) { /* this.age = age this.name = name */ } getSummary() { return `my name...