type stringclasses 7
values | content stringlengths 4 9.55k | repo stringlengths 7 96 | path stringlengths 4 178 | language stringclasses 1
value |
|---|---|---|---|---|
ArrowFunction |
(obj1: any, obj2: any): boolean => {
const tObj1 = typeof obj1
const tObj2 = typeof obj2
if (tObj1 !== tObj2) {
return false
}
if (tObj1 === 'undefined') {
return true
}
if (tObj1 !== 'object') {
return obj1 === obj2
}
if (obj1[Symbol.iterator] && obj2[Symbol.iterator]) {
const a1 = [... | biggyspender/blinq | src/comparer/deepEqual.ts | TypeScript |
ArrowFunction |
([k1], [k2]) =>
k1 > k2 ? 1 : k1 < k2 ? -1 : 0 | biggyspender/blinq | src/comparer/deepEqual.ts | TypeScript |
ArrowFunction |
({
onMint,
candyMachine,
isMinting,
isEnded,
isActive,
isSoldOut
}: {
onMint: () => Promise<void>;
... | Fulgurus/candy-machine-v2-ready-ui | src/MintButton.tsx | TypeScript |
ArrowFunction |
() => {
setIsVerifying(false);
if (gatewayStatus === GatewayStatus.COLLECTING_USER_INFORMATION && clicked) {
// when user approves wallet verification txn
setIsVerifying(true);
} else if (gatewayStatus === GatewayStatus.ACTIVE && clicked) {
console.log('Verif... | Fulgurus/candy-machine-v2-ready-ui | src/MintButton.tsx | TypeScript |
ClassDeclaration | //check Workshop Components @1:50 as this service is not completed
export class StorageService {
constructor() { }
} | DenitsaDey/Angular | 04. Workshop Components/ng-workshop/src/app/storage.service.ts | TypeScript |
ClassDeclaration |
@Injectable()
export class BrowserStorage{
localStorage = localStorage;
setItem<T>(key: string, item: T): T{
this.localStorage.setItem(key, JSON.stringify(item));
return item;
}
getItem<T>(key: string):T{
let item;
const tmp = this.localStorage.getItem(key);
//if(!tmp) {return null;}
t... | DenitsaDey/Angular | 04. Workshop Components/ng-workshop/src/app/storage.service.ts | TypeScript |
MethodDeclaration |
setItem<T>(key: string, item: T): T{
this.localStorage.setItem(key, JSON.stringify(item));
return item;
} | DenitsaDey/Angular | 04. Workshop Components/ng-workshop/src/app/storage.service.ts | TypeScript |
MethodDeclaration |
getItem<T>(key: string):T{
let item;
const tmp = this.localStorage.getItem(key);
//if(!tmp) {return null;}
try{
item = JSON.parse(tmp!);
} catch{
item = tmp;
}
return item;
} | DenitsaDey/Angular | 04. Workshop Components/ng-workshop/src/app/storage.service.ts | TypeScript |
InterfaceDeclaration |
export interface IAuthProvider {
onAuthenticationStateChanged?: (state: AuthenticationState, account?: IAccountInfo) => void;
authenticationState: AuthenticationState;
getAccountInfo(): IAccountInfo | null;
login(): void;
logout(): void;
} | Azure-Samples/react-aad-msal | packages/react-aad-msal/src/interfaces/IAuthProvider.ts | TypeScript |
ClassDeclaration | // TODO: improve this by combine into a base class shared between this and e2e-bit-json-helper
export default class ComponentJsonHelper {
scopes: ScopesData;
constructor(scopes: ScopesData) {
this.scopes = scopes;
}
read(componentRelativeDir: string) {
const componentJsonPath = this.composePath(componen... | TheRakeshPurohit/bit | src/e2e-helper/e2e-component-json-helper.ts | TypeScript |
MethodDeclaration |
read(componentRelativeDir: string) {
const componentJsonPath = this.composePath(componentRelativeDir);
if (fs.existsSync(componentJsonPath)) {
const content = fs.readJSONSync(componentJsonPath);
return content;
}
return {};
} | TheRakeshPurohit/bit | src/e2e-helper/e2e-component-json-helper.ts | TypeScript |
MethodDeclaration |
deleteIfExist(componentRelativeDir = 'bar') {
const componentJsonPath = this.composePath(componentRelativeDir);
if (fs.existsSync(componentJsonPath)) {
fs.unlinkSync(componentJsonPath);
}
} | TheRakeshPurohit/bit | src/e2e-helper/e2e-component-json-helper.ts | TypeScript |
MethodDeclaration |
write(componentJson: Record<string, any>, componentRelativeDir = 'bar') {
const componentJsonPath = this.composePath(componentRelativeDir);
const content = stringify(componentJson, null, 2);
return fs.writeFileSync(componentJsonPath, content);
} | TheRakeshPurohit/bit | src/e2e-helper/e2e-component-json-helper.ts | TypeScript |
MethodDeclaration |
addKeyVal(key: string, val: any, componentRelativeDir = 'bar') {
const componentJson = this.read(componentRelativeDir);
// Using this to keep the comments
const obj = {
[key]: val,
};
const updated = assign(componentJson, obj);
this.write(updated, componentRelativeDir);
} | TheRakeshPurohit/bit | src/e2e-helper/e2e-component-json-helper.ts | TypeScript |
MethodDeclaration |
setExtension(extensionId: string, extensionConfig: any, componentRelativeDir = 'bar') {
const componentJson = this.read(componentRelativeDir);
const extensions = componentJson.extensions || {};
extensions[extensionId] = extensionConfig;
this.addKeyVal('extensions', extensions, componentRelativeDir);
... | TheRakeshPurohit/bit | src/e2e-helper/e2e-component-json-helper.ts | TypeScript |
MethodDeclaration |
removeExtension(extensionId: string, componentRelativeDir = 'bar') {
const componentJson = this.read(componentRelativeDir);
const extensions = componentJson.extensions || {};
delete extensions[extensionId];
this.addKeyVal('extensions', extensions, componentRelativeDir);
} | TheRakeshPurohit/bit | src/e2e-helper/e2e-component-json-helper.ts | TypeScript |
MethodDeclaration |
setPropagate(propagateVal: boolean, componentRelativeDir = 'bar') {
this.addKeyVal('propagate', propagateVal, componentRelativeDir);
} | TheRakeshPurohit/bit | src/e2e-helper/e2e-component-json-helper.ts | TypeScript |
MethodDeclaration |
addDefaultScope(scope = this.scopes.remote) {
this.addKeyVal('defaultScope', scope);
} | TheRakeshPurohit/bit | src/e2e-helper/e2e-component-json-helper.ts | TypeScript |
MethodDeclaration |
composePath(componentRelativeDir = 'bar', absolutePath = true): string {
const file = path.join(componentRelativeDir, COMPONENT_CONFIG_FILE_NAME);
return absolutePath ? path.join(this.scopes.localPath, file) : file;
} | TheRakeshPurohit/bit | src/e2e-helper/e2e-component-json-helper.ts | TypeScript |
ArrowFunction |
async (t: Test) => {
const pruning = pruneDockerAllIfGithubAction({ logLevel });
await t.doesNotReject(pruning, "Pruning did not throw OK");
t.end();
} | Be-Secure/cactus | packages/cactus-test-plugin-htlc-eth-besu/src/test/typescript/integration/plugin-htlc-eth-besu/refund-endpoint.test.ts | TypeScript |
ArrowFunction |
async (t: Test) => {
const timeout = (ms: number) => {
return new Promise((resolve) => setTimeout(resolve, ms));
};
t.comment("Starting Besu Test Ledger");
const besuTestLedger = new BesuTestLedger({ logLevel });
test.onFailure(async () => {
await besuTestLedger.stop();
await besuTestLedger.dest... | Be-Secure/cactus | packages/cactus-test-plugin-htlc-eth-besu/src/test/typescript/integration/plugin-htlc-eth-besu/refund-endpoint.test.ts | TypeScript |
ArrowFunction |
(ms: number) => {
return new Promise((resolve) => setTimeout(resolve, ms));
} | Be-Secure/cactus | packages/cactus-test-plugin-htlc-eth-besu/src/test/typescript/integration/plugin-htlc-eth-besu/refund-endpoint.test.ts | TypeScript |
ArrowFunction |
(resolve) => setTimeout(resolve, ms) | Be-Secure/cactus | packages/cactus-test-plugin-htlc-eth-besu/src/test/typescript/integration/plugin-htlc-eth-besu/refund-endpoint.test.ts | TypeScript |
ArrowFunction |
async () => {
await besuTestLedger.stop();
await besuTestLedger.destroy();
} | Be-Secure/cactus | packages/cactus-test-plugin-htlc-eth-besu/src/test/typescript/integration/plugin-htlc-eth-besu/refund-endpoint.test.ts | TypeScript |
ArrowFunction |
async () => await Servers.shutdown(server) | Be-Secure/cactus | packages/cactus-test-plugin-htlc-eth-besu/src/test/typescript/integration/plugin-htlc-eth-besu/refund-endpoint.test.ts | TypeScript |
ClassDeclaration |
export class UnfetterIdentityMock extends Mock<UnfetterIdentity> {
public mockOne(): UnfetterIdentity {
const tmp = new UnfetterIdentity();
tmp.id = this.genId();
tmp.name = 'bob';
tmp.contact_information = 'bob at po box';
tmp.sectors = ['automotive'];
return tmp;
... | unfetter-discover/stix | src/unfetter/unfetter-identity.mock.ts | TypeScript |
MethodDeclaration |
public mockOne(): UnfetterIdentity {
const tmp = new UnfetterIdentity();
tmp.id = this.genId();
tmp.name = 'bob';
tmp.contact_information = 'bob at po box';
tmp.sectors = ['automotive'];
return tmp;
} | unfetter-discover/stix | src/unfetter/unfetter-identity.mock.ts | TypeScript |
TypeAliasDeclaration |
export type LogAction = 'created' | 'updated' | 'removed' | 'cleared'; | normalized-db/data-store | src/logging/model/log-action.ts | TypeScript |
ArrowFunction |
(
req: Request,
res: Response,
next: NextFunction
) => {
if (!req.session?.jwt) {
return next();
}
try {
const payload = jwt.verify(
req.session.jwt,
process.env.JWT_KEY!
) as UserPayload;
req.currentUser = payload;
} catch (err) {}
... | alpe89/microservices-big-ticket | auth/src/middlewares/current-user.ts | TypeScript |
InterfaceDeclaration |
interface UserPayload {
id: string;
email: string;
} | alpe89/microservices-big-ticket | auth/src/middlewares/current-user.ts | TypeScript |
InterfaceDeclaration |
interface Request {
currentUser?: UserPayload;
} | alpe89/microservices-big-ticket | auth/src/middlewares/current-user.ts | TypeScript |
InterfaceDeclaration | /**
* DescribeSimulationJobInput shape
*/
export interface DescribeSimulationJobInput {
/**
* <p>The Amazon Resource Name (ARN) of the simulation job to be described.</p>
*/
job: string;
/**
* The maximum number of times this operation should be retried. If set, this value will override the `maxRetrie... | Dylan0916/aws-sdk-js-v3 | clients/browser/client-robomaker-browser/types/DescribeSimulationJobInput.ts | TypeScript |
ArrowFunction |
() => {
let service: CampaignsService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(CampaignsService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
} | Vibra-team/rec | admin/src/app/pages/campaigns/services/campaigns.service.spec.ts | TypeScript |
ArrowFunction |
() => {
TestBed.configureTestingModule({});
service = TestBed.inject(CampaignsService);
} | Vibra-team/rec | admin/src/app/pages/campaigns/services/campaigns.service.spec.ts | TypeScript |
ClassDeclaration | /**
* Exception manager exposes the API to register custom error handler
* and invoke it when exceptions are raised during the HTTP
* lifecycle.
*/
export class ExceptionManager {
/**
* Resolved copy of error handler
*/
private resolvedErrorHandler?: ResolvedErrorHandler
/**
* A reference to ioc resolver ... | Vini98br/http-server | src/Server/ExceptionManager/index.ts | TypeScript |
MethodDeclaration | /**
* Register a custom error handler
*/
public registerHandler(handler: ErrorHandler) {
if (typeof handler === 'string') {
this.resolvedErrorHandler = {
type: 'class',
value: this.container.make(this.resolver.resolve(handler)),
}
} else {
this.resolvedErrorHandler = {
type: 'function',
... | Vini98br/http-server | src/Server/ExceptionManager/index.ts | TypeScript |
MethodDeclaration | /**
* Handle error
*/
private async handleError(error: any, ctx: HttpContextContract) {
ctx.response.safeStatus(error.status || 500)
/*
* Make response when no error handler has been registered
*/
if (!this.resolvedErrorHandler) {
ctx.response.send(error.message)
return
}
/*
* Invoke the ... | Vini98br/http-server | src/Server/ExceptionManager/index.ts | TypeScript |
MethodDeclaration | /**
* Report error when report method exists
*/
private async reportError(error: any, ctx: HttpContextContract) {
if (
this.resolvedErrorHandler &&
this.resolvedErrorHandler.type === 'class' &&
typeof this.resolvedErrorHandler.value['report'] === 'function'
) {
try {
await this.resolvedErrorHand... | Vini98br/http-server | src/Server/ExceptionManager/index.ts | TypeScript |
MethodDeclaration | /**
* Handle the error
*/
public async handle(error: any, ctx: HttpContextContract) {
await this.handleError(error, ctx)
this.reportError(error, ctx)
} | Vini98br/http-server | src/Server/ExceptionManager/index.ts | TypeScript |
FunctionDeclaration |
function getCartItem(name: string) {
return cy.get('cx-cart-item-list').contains('.cx-item-list-row', name);
} | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
FunctionDeclaration |
function checkCartSummary(subtotal: string) {
cy.get('cx-order-summary').within(() => {
cy.get('.cx-summary-row:first').contains('Subtotal');
cy.get('.cx-summary-amount').should('contain', subtotal);
});
} | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
FunctionDeclaration |
function incrementQuantity() {
cy.get('cx-item-counter button').contains('+').click();
} | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
FunctionDeclaration |
function goToFirstProductFromSearch(id: string, mobile: boolean) {
cy.get('cx-storefront.stop-navigating');
if (mobile) {
cy.get('cx-searchbox cx-icon[aria-label="Search"]').click();
createProductQuery(
QUERY_ALIAS.PRODUCE_CODE,
id,
PRODUCT_LISTING.PRODUCTS_PER_PAGE
);
cy.get('c... | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
FunctionDeclaration |
function checkMiniCartCount(expectedCount) {
return cy.get('cx-mini-cart').within(() => {
cy.get('.count').should('contain', expectedCount);
});
} | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
FunctionDeclaration |
export function clickAddToCart() {
cy.get('cx-add-to-cart button[type=submit]').first().click({ force: true });
} | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
FunctionDeclaration | /**
* Adds product from PDP directly
* @param productCode
*/
export function addProductFromPdp(productCode: string = products[0].code) {
const pdpUrl = `${getBaseUrlPrefix()}/product/${productCode}`;
registerCartRefreshRoute();
registerCartPageRoute();
// Add product from PDP directly
cy.visit(pdpUrl);
... | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
FunctionDeclaration |
export function checkBasicCart() {
const cartUrl = `${getBaseUrlPrefix()}/cart`;
cy.visit(cartUrl);
validateEmptyCart();
addProductFromPdp(products[0].code);
cy.log(`Adding second product to cart via search page`);
cy.onMobile(() => {
cy.get('.search').click();
});
cy.get('cx-searchbox input')... | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
FunctionDeclaration |
export function validateEmptyCart() {
cy.get('cx-breadcrumb h1').should('contain', 'Your Shopping Cart');
cy.get('.EmptyCartMiddleContent').should(
'contain',
'Your shopping cart is empty'
);
} | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
FunctionDeclaration |
function getOccUrlPrefix() {
return `${Cypress.env('OCC_PREFIX')}/${Cypress.env('BASE_SITE')}`;
} | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
FunctionDeclaration |
function getBaseUrlPrefix() {
return `/${Cypress.env('BASE_SITE')}/${Cypress.env(
'BASE_LANG'
)}/${Cypress.env('BASE_CURRENCY')}`;
} | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
FunctionDeclaration |
export function registerCartPageRoute() {
cy.intercept(
'GET',
`${getOccUrlPrefix()}/cms/pages?pageType=ContentPage&pageLabelOrId=%2Fcart&lang=en&curr=USD`
).as('cart_page');
} | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
FunctionDeclaration |
export function registerCartRefreshRoute() {
cy.intercept(
'GET',
`${getOccUrlPrefix()}/users/*/carts/*?fields=*&lang=en&curr=USD`
).as('refresh_cart');
} | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
FunctionDeclaration |
export function registerCreateCartRoute() {
cy.intercept(
'POST',
`${getOccUrlPrefix()}/users/*/carts?fields=*&lang=en&curr=USD`
).as('create_cart');
} | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
FunctionDeclaration |
export function registerDeleteCartItemRoute() {
cy.intercept(
'DELETE',
`${getOccUrlPrefix()}/users/*/carts/*/entries/*?lang=en&curr=USD`
).as('delete_cart_item');
} | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
FunctionDeclaration |
export function registerSaveCartRoute() {
cy.intercept(
'PATCH',
`${getOccUrlPrefix()}/users/*/carts/*/save?lang=en&curr=USD`
).as('save_cart');
} | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
FunctionDeclaration |
export function closeAddedToCartDialog() {
cy.get('span > .cx-icon.fa-times').click({ force: true });
} | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
FunctionDeclaration |
export function checkProductInCart(product, qty = 1, currency = 'USD') {
return getCartItem(product.name).within(() => {
cy.get('.cx-price>.cx-value').should(
'contain',
formatPrice(product.price, currency)
);
cy.get('cx-item-counter input').should('have.value', `${qty}`);
cy.get('.cx-tot... | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
FunctionDeclaration |
export function checkAddedToCartDialog(itemsNumber = 1) {
cy.get('cx-added-to-cart-dialog .cx-dialog-total').should(
'contain',
`Cart total (${itemsNumber} item${itemsNumber > 1 ? 's' : ''})`
);
} | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
FunctionDeclaration |
export function checkClearCartDialog() {
cy.get('cx-clear-cart-dialog .cx-clear-cart-header').should(
'contain',
'Clear Cart'
);
} | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
FunctionDeclaration |
export function removeAllItemsFromCart() {
registerCartRefreshRoute();
removeCartItem(products[0]);
cy.wait('@refresh_cart');
removeCartItem(products[4]);
validateEmptyCart();
} | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
FunctionDeclaration |
export function removeCartItem(product) {
registerDeleteCartItemRoute();
getCartItem(product.name).within(() => {
cy.get('button.cx-remove-btn').click();
});
cy.wait('@delete_cart_item');
} | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
FunctionDeclaration |
export function loginRegisteredUser() {
standardUser.registrationData.email = generateMail(randomString(), true);
cy.requireLoggedIn(standardUser);
cy.reload();
} | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
FunctionDeclaration |
export function addProductWhenLoggedIn(mobile: boolean) {
const product = products[1];
goToFirstProductFromSearch(product.code, mobile);
clickAddToCart();
cy.wait('@create_cart');
checkAddedToCartDialog();
closeAddedToCartDialog();
} | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
FunctionDeclaration |
export function logOutAndNavigateToEmptyCart() {
const logoutPage = waitForPage('/logout', 'getLogoutPage');
cy.selectUserMenuOption({
option: 'Sign Out',
});
cy.wait(`@${logoutPage}`);
clickHamburger();
cy.get('cx-login [role="link"]').should('contain', 'Sign In');
const cartPage = waitForPage('/... | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
FunctionDeclaration |
export function addProducts() {
const prods = products.slice(0, 3);
prods.forEach((product) => {
cy.visit(`/product/${product.code}`);
clickAddToCart();
closeAddedToCartDialog();
});
} | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
FunctionDeclaration |
export function addProductAsAnonymous() {
const product = products[2];
createProductQuery(
QUERY_ALIAS.PRODUCE_CODE,
product.code,
PRODUCT_LISTING.PRODUCTS_PER_PAGE
);
cy.get('cx-searchbox input').type(`${product.code}{enter}`, {
force: true,
});
cy.wait(`@${QUERY_ALIAS.PRODUCE_CODE}`)
... | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
FunctionDeclaration |
export function getClearCartDialog() {
return cy
.get('cx-clear-cart')
.get('.clear-cart-btn')
.scrollIntoView()
.click();
} | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
FunctionDeclaration |
export function goToCart() {
const cartPage = waitForPage('/cart', 'getCartPage');
cy.visit('/cart');
cy.wait(`@${cartPage}`).its('response.statusCode').should('eq', 200);
cy.get('cx-breadcrumb h1').should('contain', 'Your Shopping Cart');
} | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
FunctionDeclaration |
export function cancelClearCart() {
getClearCartDialog().then(() => {
checkClearCartDialog();
cy.get('.cx-clear-cart-footer .btn-action').click();
});
} | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
FunctionDeclaration |
export function clearActiveCart() {
getClearCartDialog().then(() => {
checkClearCartDialog();
cy.get('.cx-clear-cart-footer .btn-primary').click();
});
} | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
FunctionDeclaration |
export function verifyCartNotEmpty() {
cy.get('cx-mini-cart .count').should('not.match', '0');
} | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
FunctionDeclaration |
export function verifyMergedCartWhenLoggedIn() {
const product0 = products[1];
const product1 = products[2];
const loginPage = waitForPage('/login', 'getLoginPage');
clickHamburger();
cy.get('cx-login [role="link"]').click();
cy.wait(`@${loginPage}`).its('response.statusCode').should('eq', 200);
logi... | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
FunctionDeclaration |
export function logOutAndEmptyCart() {
const logoutPage = waitForPage('/logout', 'getLogoutPage');
cy.selectUserMenuOption({
option: 'Sign Out',
});
cy.wait(`@${logoutPage}`);
waitForHomePage();
const cartPage = waitForPage('/cart', 'getCartPage');
cy.visit('/cart');
cy.wait(`@${cartPage}`);
v... | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
FunctionDeclaration |
export function manipulateCartQuantity() {
const product = products[1];
registerCartRefreshRoute();
registerCartPageRoute();
cy.visit(`/product/${product.code}`);
clickAddToCart();
cy.wait('@refresh_cart');
checkAddedToCartDialog();
closeAddedToCartDialog();
checkMiniCartCount(1);
cy.get('cx-... | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
FunctionDeclaration |
export function outOfStock() {
const product = products[3];
cy.visit(`/product/${product.code}`);
cy.get('cx-add-to-cart .quantity').should('contain', 'Out of stock');
cy.get('cx-add-to-cart cx-add-to-cart button').should('not.exist');
} | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
FunctionDeclaration |
export function registerCartUser(user = cartUser) {
const registerPage = waitForPage('/login/register', 'getRegisterPage');
cy.visit('/login/register');
cy.wait(`@${registerPage}`);
register({ ...user.registrationData });
cy.url().should('not.contain', 'register');
} | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
FunctionDeclaration |
export function loginCartUser(user = cartUser) {
const loginPage = waitForPage('/login', 'getLoginPage');
cy.visit('/login');
cy.wait(`@${loginPage}`).its('response.statusCode').should('eq', 200);
login(user.registrationData.email, user.registrationData.password);
return cy.url().should('not.contain', 'login... | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
FunctionDeclaration |
export function saveCartId() {
cy.get('cx-cart-details')
.get('h2.cx-total')
.then(($cartId) => {
let cartId = $cartId.text();
cy.wrap(cartId).as('cartId');
});
} | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
FunctionDeclaration |
export function verifyCartIdAfterClearCart() {
cy.visit(`/product/${products[0].code}`);
clickAddToCart();
checkAddedToCartDialog();
closeAddedToCartDialog();
goToCart();
let _cartId;
cy.get('cx-cart-details')
.get('h2.cx-total')
.then(($cartId) => {
_cartId = $cartId.text();
});
cy... | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
ArrowFunction |
(price: number, currency: string = 'USD') => {
if (currency === 'USD') {
return new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'USD',
minimumFractionDigits: 2,
}).format(price);
} else if (currency === 'GBP') {
return new Intl.NumberFormat('en-GB', {
style: 'curre... | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
ArrowFunction |
() => {
cy.get('.cx-summary-row:first').contains('Subtotal');
cy.get('.cx-summary-amount').should('contain', subtotal);
} | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
ArrowFunction |
() => {
cy.get('.count').should('contain', expectedCount);
} | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
ArrowFunction |
() => {
cy.get('.search').click();
} | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
ArrowFunction |
() => {
incrementQuantity();
} | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
ArrowFunction |
() => {
cy.get('.cx-price>.cx-value').should(
'contain',
formatPrice(product.price, currency)
);
cy.get('cx-item-counter input').should('have.value', `${qty}`);
cy.get('.cx-total>.cx-value').should(
'contain',
formatPrice(qty * product.price, currency)
);
cy.root();
} | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
ArrowFunction |
() => {
cy.get('button.cx-remove-btn').click();
} | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
ArrowFunction |
(product) => {
cy.visit(`/product/${product.code}`);
clickAddToCart();
closeAddedToCartDialog();
} | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
ArrowFunction |
() => {
clickAddToCart();
} | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
ArrowFunction |
() => {
checkClearCartDialog();
cy.get('.cx-clear-cart-footer .btn-action').click();
} | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
ArrowFunction |
() => {
checkClearCartDialog();
cy.get('.cx-clear-cart-footer .btn-primary').click();
} | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
ArrowFunction |
($cartId) => {
let cartId = $cartId.text();
cy.wrap(cartId).as('cartId');
} | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
ArrowFunction |
($cartId) => {
_cartId = $cartId.text();
} | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
ArrowFunction |
(cartId) => {
expect(cartId).to.not.eq(_cartId);
} | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
InterfaceDeclaration |
interface TestProduct {
code: string;
name?: string;
price?: number;
} | I539321/spartacus | projects/storefrontapp-e2e-cypress/cypress/helpers/cart.ts | TypeScript |
ArrowFunction |
(path: string): Record<string, unknown> => {
try {
if (!path) throw new Error(ErrorSliceOutObjectFromFile);
const DATA = fs.readFileSync(path, 'utf8');
if (!DATA) throw new Error(ErrorSliceOutObjectFromFile);
const SLICED_DATA = DATA.slice(DATA.indexOf('{'), DATA.indexOf('}') + 1);
return JSON... | flo-sch/figmagic | bin/entities/FigmagicElement/logic/sliceOutObjectFromFile.ts | TypeScript |
ArrowFunction |
() => {
// @ts-ignore
const connection = new Connection(network, opts.preflightCommitment);
const provider = new Provider(
connection,
// @ts-ignore
window.solana,
// @ts-ignore
opts.preflightCommitment,
);
return provider;
} | abigger87/density | src/utils/GetProvider.tsx | TypeScript |
ArrowFunction |
(resolve): void => {
this.db.close().then((): void => {
resolve();
});
} | GabrieleNunez/job-process | src/drivers/database.ts | TypeScript |
ArrowFunction |
(): void => {
resolve();
} | GabrieleNunez/job-process | src/drivers/database.ts | TypeScript |
ClassDeclaration | /**
* A class that starts and wraps basic database functionality using Sequelize
*/
export class Database {
private db: Sequelize.Sequelize;
/**
* Construct the basic datbaase object and initialize a connection
*/
public constructor(ormOptions: DatabaseOptions) {
this.db = new Sequelize... | GabrieleNunez/job-process | src/drivers/database.ts | TypeScript |
InterfaceDeclaration | /**
* A complete set of options for our database driver to use
*/
export interface DatabaseOptions {
login: {
database: string;
username: string;
password: string;
};
orm: Sequelize.Options;
} | GabrieleNunez/job-process | src/drivers/database.ts | TypeScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.