Skip to content

Instantly share code, notes, and snippets.

View albarivas's full-sized avatar

Alba Rivas albarivas

View GitHub Profile
@isTest
private with sharing class SampleBadMethodsTest {
@isTest
private static void iAddUpPositiveIntegers_positive() { // Happy path
// GIVEN
Integer a = 10;
Integer b = 20;
// WHEN
Test.startTest();
@isTest
public with sharing class RecipeTriggerTest {
@isTest static void fieldsAreRequired() {
Recipe__c recipe = new Recipe__c();
String exceptionMessage;
try {
Test.startTest();
public with sharing class MyCalculator {
// Static methods are used to perform instant calculations,
// method starts, runs, and returns something, but nothing is stored in memory!
public static Integer sum (Integer a, Integer b) {
return a + b;
}
}
import cpx from 'cpx';
import { log } from 'console';
// Copy the SLDS resources to the assets dir
cpx.copy('../../node_modules/@salesforce-ux/design-system/assets/**/*', 'src/assets', () => {
log(`Done copying SLDS resources`);
});
(function s() {
return function () {
$A.componentService.addModule(
"markup://c:lwcAgGrid",
"c/lwcAgGrid",
[
"lwc",
"lightning/platformResourceLoader",
"@salesforce/resourceUrl/agGridMin"
],
import { LightningElement, api, track } from 'lwc';
/******************
* APEX METHODS
******************/
import toogleValidationRule from '@salesforce/apex/DataloadSwitchController.toogleValidationRule';
export default class ToogleValidationRule extends LightningElement {
public with sharing class DataloadSwitchController {
@AuraEnabled
public static String toogleValidationRule(String validationRuleId, Boolean state){
System.debug('Toggle apex method called');
System.debug('validationRuleId: '+ validationRuleId);
System.debug('state: ' + state);
HttpResponse resp = new HttpResponse();
resp.setStatusCode(204);
resp.setBody('empty body');