Best JavaScript code snippet using playwright-internal
options.js
Source:options.js
...163 components: function (parentVal, childVal, vm, key) {164 const res = Object.create(parentVal || null)165 if (childVal) {166 process.env.NODE_ENV !== 'production'167 && assertObjectType(key, childVal, vm)168 return extend(res, childVal)169 } else {170 return res171 }172 },173 directives: function (parentVal, childVal, vm, key) {174 const res = Object.create(parentVal || null)175 if (childVal) {176 process.env.NODE_ENV !== 'production'177 && assertObjectType(key, childVal, vm)178 return extend(res, childVal)179 } else {180 return res181 }182 },183 filters: function (parentVal, childVal, vm, key) {184 const res = Object.create(parentVal || null)185 if (childVal) {186 process.env.NODE_ENV !== 'production'187 && assertObjectType(key, childVal, vm)188 return extend(res, childVal)189 } else {190 return res191 }192 },193 watch: function (parentVal, childVal, vm, key) {194 if (parentVal === nativeWatch) parentVal = undefined195 if (childVal === nativeWatch) childVal = undefined196 if (!childVal) return Object.create(parentVal || null)197 if (process.env.NODE_ENV !== 'production') {198 assertObjectType(key, childVal, vm)199 }200 if (!parentVal) return childVal201 const ret = {}202 extend(ret, parentVal)203 for (const key in childVal) {204 let parent = ret[key]205 const child = childVal[key]206 if (parent && !Array.isArray(parent)) {207 parent = [parent]208 }209 ret[key] = parent210 ? parent.concat(child)211 : Array.isArray(child) ? child : [child]212 }213 return ret214 },215 props: function (parentVal, childVal, vm, key) {216 //åæ°childValåå¨å¹¶ä¸ä¸æ¯ç产ç¯å¢ï¼æ£æµchildValæ¯å¦ä¸ºå¯¹è±¡217 if (childVal && process.env.NODE_ENV !== 'production') {218 assertObjectType(key, childVal, vm)219 }220 //ä¸åå¨parentValåæ°ï¼ç´æ¥è¿åchildVal221 if (!parentVal) return childVal222 const ret = Object.create(null)223 //å°parentVal对象å并å°ä¸ä¸ªåå为空ç空对象ä¸224 extend(ret, parentVal)225 //åå¨childValåæ°ï¼é£å°±å°childVal对象å并è¿ret对象226 if (childVal) extend(ret, childVal)227 return ret228 },229 methods: function (parentVal, childVal, vm, key) {230 //åæ°childValåå¨å¹¶ä¸ä¸æ¯ç产ç¯å¢ï¼æ£æµchildValæ¯å¦ä¸ºå¯¹è±¡231 if (childVal && process.env.NODE_ENV !== 'production') {232 assertObjectType(key, childVal, vm)233 }234 //ä¸åå¨parentValåæ°ï¼ç´æ¥è¿åchildVal235 if (!parentVal) return childVal236 const ret = Object.create(null)237 //å°parentVal对象å并å°ä¸ä¸ªåå为空ç空对象ä¸238 extend(ret, parentVal)239 //åå¨childValåæ°ï¼é£å°±å°childVal对象å并è¿ret对象240 if (childVal) extend(ret, childVal)241 return ret242 },243 inject: function (parentVal, childVal, vm, key) {244 //åæ°childValåå¨å¹¶ä¸ä¸æ¯ç产ç¯å¢ï¼æ£æµchildValæ¯å¦ä¸ºå¯¹è±¡245 if (childVal && process.env.NODE_ENV !== 'production') {246 assertObjectType(key, childVal, vm)247 }248 //ä¸åå¨parentValåæ°ï¼ç´æ¥è¿åchildVal249 if (!parentVal) return childVal250 const ret = Object.create(null)251 //å°parentVal对象å并å°ä¸ä¸ªåå为空ç空对象ä¸252 extend(ret, parentVal)253 //åå¨childValåæ°ï¼é£å°±å°childVal对象å并è¿ret对象254 if (childVal) extend(ret, childVal)255 return ret256 },257 computed: function (parentVal, childVal, vm, key) {258 //åæ°childValåå¨å¹¶ä¸ä¸æ¯ç产ç¯å¢ï¼æ£æµchildValæ¯å¦ä¸ºå¯¹è±¡259 if (childVal && process.env.NODE_ENV !== 'production') {260 assertObjectType(key, childVal, vm)261 }262 //ä¸åå¨parentValåæ°ï¼ç´æ¥è¿åchildVal263 if (!parentVal) return childVal264 const ret = Object.create(null)265 //å°parentVal对象å并å°ä¸ä¸ªåå为空ç空对象ä¸266 extend(ret, parentVal)267 //åå¨childValåæ°ï¼é£å°±å°childVal对象å并è¿ret对象268 if (childVal) extend(ret, childVal)269 return ret270 },271 provide: function (parentVal, childVal, vm) {272 //ä¸åå¨vueå®ä¾273 if (!vm) {274 // in a Vue.extend merge, both should be functions275 //ä¸åå¨éè¦childValç´æ¥è¿åparentVal276 if (!childVal) {277 return parentVal278 }279 //ä¸åå¨éè¦parentValç´æ¥è¿åchildVal280 if (!parentVal) {281 return childVal282 }283 // when parentVal & childVal are both present,284 // we need to return a function that returns the285 // merged result of both functions... no need to286 // check if parentVal is a function here because287 // it has to be a function to pass previous merges.288 //å½ä¸è
é½æ²¡ææ¶ || childValåparentValé½åå¨æ¶ï¼è¿åä¸é¢è¿ä¸ªå½æ°289 return function mergedDataFn () {290 //å¦æåæ°ä¸ºå½æ°åä¼ å
¥çå®é
åæ°æ¯å½æ°è¿åçå¼,å¦åç´æ¥ä¼ å
¥è¿ä¸ªåæ°291 //ä¸é¢è¿ä¸ªå½æ°è¿å深度å并è¿çchildValæchildValå½æ°çå¼292 return mergeData(293 typeof childVal === 'function' ? childVal.call(this, this) : childVal,294 typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal295 )296 }297 }298 //åå¨vueå®ä¾299 else {300 return function mergedInstanceDataFn () {301 // instance merge302 //ç¼åchildValæchildVal为å½æ°æ¶è¿åçå¼303 const instanceData = typeof childVal === 'function'304 ? childVal.call(vm, vm)305 : childVal306 //ç¼åparentValæparentVal为å½æ°æ¶è¿åçå¼307 const defaultData = typeof parentVal === 'function'308 ? parentVal.call(vm, vm)309 : parentVal310 //instanceDataæ¯å¦åå¨,åå¨åå并è¿ä¸¤ä¸ªå¯¹è±¡,ä¸åå¨è¿åé»è®¤çdefaultData311 if (instanceData) {312 return mergeData(instanceData, defaultData)313 } else {314 return defaultData315 }316 }317 }318 },319 }320 */321/**322 * Options with restrictions323 */324if (process.env.NODE_ENV !== 'production') {325 /*æç¤ºä½ el é项æè
propsData é项åªè½å¨ä½¿ç¨ new æä½ç¬¦å建å®ä¾çæ¶åå¯ç¨*/326 strats.el = strats.propsData = function (parent, child, vm, key) {327 if (!vm) {328 warn(329 `option "${key}" can only be used during instance ` +330 'creation with the `new` keyword.'331 )332 }333 return defaultStrat(parent, child)334 }335}336/**337 * Helper that recursively merges two data objects together.338 */339/*ä½ç¨: 深度åå¹¶ä¼ å
¥ç2个类å为对象çåæ°*/340function mergeData (to: Object, from: ?Object): Object {341 if (!from) return to342 let key, toVal, fromVal343 const keys = Object.keys(from)344 for (let i = 0; i < keys.length; i++) {345 key = keys[i] //ç¼åformçkeyå346 toVal = to[key] //ç¼åto[key]çå¼347 fromVal = from[key] //ç¼åfrom[key]çå¼348 //keyä¸åå¨to对象ä¸,å°keyåkeyå¼è®¾ç½®å°to对象ä¸349 if (!hasOwn(to, key)) {350 set(to, key, fromVal)351 } else if (isPlainObject(toVal) && isPlainObject(fromVal)) {352 /*353 å¤æto[key]åfrom[key]çå¼æ¯å¦é½ä¸ºå¯¹è±¡354 1ãæ¯: éå½è¿ä¸ªå½æ°355 2ãå¦: 继ç»ä¸ä¸ä¸ªå¾ªç¯ï¼ç¥ééåºå¾ªç¯356 */357 mergeData(toVal, fromVal)358 }359 }360 return to361}362/**363 * Data364 */365/*ä½ç¨: è¿åä¸ä¸ª[å并parentValå childVal]çæ¹æ³*/366export function mergeDataOrFn (367 parentVal: any,368 childVal: any,369 vm?: Component370): ?Function {371 //ä¸åå¨vueå®ä¾372 if (!vm) {373 // in a Vue.extend merge, both should be functions374 //ä¸åå¨éè¦childValç´æ¥è¿åparentVal375 if (!childVal) {376 return parentVal377 }378 //ä¸åå¨éè¦parentValç´æ¥è¿åchildVal379 if (!parentVal) {380 return childVal381 }382 // when parentVal & childVal are both present,383 // we need to return a function that returns the384 // merged result of both functions... no need to385 // check if parentVal is a function here because386 // it has to be a function to pass previous merges.387 //å½ä¸è
é½æ²¡ææ¶ || childValåparentValé½åå¨æ¶ï¼è¿åä¸é¢è¿ä¸ªå½æ°388 return function mergedDataFn () {389 //å¦æåæ°ä¸ºå½æ°åä¼ å
¥çå®é
åæ°æ¯å½æ°è¿åçå¼,å¦åç´æ¥ä¼ å
¥è¿ä¸ªåæ°390 //ä¸é¢è¿ä¸ªå½æ°è¿å深度å并è¿çchildValæchildValå½æ°çå¼391 return mergeData(392 typeof childVal === 'function' ? childVal.call(this, this) : childVal,393 typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal394 )395 }396 }397 //åå¨vueå®ä¾398 else {399 return function mergedInstanceDataFn () {400 // instance merge401 //ç¼åchildValæchildVal为å½æ°æ¶è¿åçå¼402 const instanceData = typeof childVal === 'function'403 ? childVal.call(vm, vm)404 : childVal405 //ç¼åparentValæparentVal为å½æ°æ¶è¿åçå¼406 const defaultData = typeof parentVal === 'function'407 ? parentVal.call(vm, vm)408 : parentVal409 //instanceDataæ¯å¦åå¨,åå¨åå并è¿ä¸¤ä¸ªå¯¹è±¡,ä¸åå¨è¿åé»è®¤çdefaultData410 if (instanceData) {411 return mergeData(instanceData, defaultData)412 } else {413 return defaultData414 }415 }416 }417}418strats.data = function (419 parentVal: any,420 childVal: any,421 vm?: Component422): ?Function {423 //å¤ææ¯å¦ævueå®ä¾424 if (!vm) {425 //没æå®ä¾å¹¶ä¸childValä¸æ¯å½æ°æ示è¦å(è¿å°±æ¯vue模æ¿ä¸dataè¦æ¯å½æ°çåå )426 if (childVal && typeof childVal !== 'function') {427 process.env.NODE_ENV !== 'production' && warn(428 'The "data" option should be a function ' +429 'that returns a per-instance value in component ' +430 'definitions.',431 vm432 )433 return parentVal434 }435 return mergeDataOrFn(parentVal, childVal)436 }437 return mergeDataOrFn(parentVal, childVal, vm)438}439/**440 * Hooks and props are merged as arrays.441 */442/*å并çå½å¨æé©åå½æ°*/443function mergeHook (444 parentVal: ?Array<Function>,445 childVal: ?Function | ?Array<Function>446): ?Array<Function> {447 return childVal448 ? parentVal449 ? parentVal.concat(childVal)450 : Array.isArray(childVal)451 ? childVal452 : [childVal]453 : parentVal454}455LIFECYCLE_HOOKS.forEach(hook => {456 strats[hook] = mergeHook457})458/**459 * Assets460 *461 * When a vm is present (instance creation), we need to do462 * a three-way merge between constructor options, instance463 * options and parent options.464 */465//å并2个åæ°å¯¹è±¡(å
¶å®å°±æ¯å并ç»ä»¶ãæ令ãè¿æ»¤å¨è¿äºå¯¹è±¡)466function mergeAssets (467 parentVal: ?Object,468 childVal: ?Object,469 vm?: Component,470 key: string471): Object {472 //__proto__æ¯æ¯ä¸ªå¯¹è±¡é½æçä¸ä¸ªå±æ§ï¼èprototypeæ¯å½æ°æä¼æçå±æ§473 //parentValåå¨åå建åå为parentValç对象474 const res = Object.create(parentVal || null)475 if (childVal) {476 //å¨éç产ç¯å¢çæµchildValæ¯å¦ä¸ºå¯¹è±¡ï¼å¹¶è¿è¡ç¸åºçè¦åæ示477 process.env.NODE_ENV !== 'production' && assertObjectType(key, childVal, vm)478 return extend(res, childVal)479 } else {480 return res481 }482}483ASSET_TYPES.forEach(function (type) {484 strats[type + 's'] = mergeAssets485})486/**487 * Watchers.488 *489 * Watchers hashes should not overwrite one490 * another, so we merge them as arrays.491 */492/*493 ä½ç¨: å并parentValåchildVal对象æå°[parentValåchildVal对象ä¸çå±æ§]æ¼æ¥ææ°ç»494 1ãchildValä¸åå¨ï¼è¿ååå为parentValç空对象495 2ãparentValä¸åå¨ï¼è¿åchildVal496 3ãå°parentValæchildValçkeyå¼è½¬ä¸ºæ°ç»,497 é½åå¨è¿ä¸ªkeyåå°keyå¼è½¬ä¸ºæ°ç»è¿è¡æ¼æ¥æä¸ä¸ªæ°æ°ç»498*/499strats.watch = function (500 parentVal: ?Object,501 childVal: ?Object,502 vm?: Component,503 key: string504): ?Object {505 // work around Firefox's Object.prototype.watch...506 //Firefoxæµè§å¨ç对象ååèªå¸¦watchå±æ§507 if (parentVal === nativeWatch) parentVal = undefined508 if (childVal === nativeWatch) childVal = undefined509 /* istanbul ignore if */510 //ä¸åå¨childValï¼ç´æ¥è¿ååå为parentVal || nullç空对象511 if (!childVal) return Object.create(parentVal || null)512 //éç产ç¯å¢å¯¹childValä¸ä¸ºå¯¹è±¡æ¶è¦åæ示513 if (process.env.NODE_ENV !== 'production') {514 assertObjectType(key, childVal, vm)515 }516 //ä¸åå¨parentValç´æ¥è¿åchildVal517 if (!parentVal) return childVal518 const ret = {}519 //å并parentValå°ä¸ä¸ªæ°ç空对象ä¸520 extend(ret, parentVal)521 //循ç¯childVal522 for (const key in childVal) {523 //ç¼åä¸æ°å¯¹è±¡ä¸keyåç¸åçå±æ§çå¼524 let parent = ret[key]525 //ç¼åchildVal[key]çå¼526 const child = childVal[key]527 //parent && parentä¸ä¸ºæ°ç»åå°parent转å为æ°ç»528 if (parent && !Array.isArray(parent)) {529 parent = [parent]530 }531 //åå¨parentï¼åå°childVal[key]å¼æ¼æ¥è¿parentæ°ç»ä¸532 //ä¸åå¨parentï¼åå¤æchildVal[key]çå¼æ¯å¦ä¸ºæ°ç»533 //æ¯: è¿åç¼åchildVal[key]å¼çchild534 //ä¸æ¯ï¼ å°childVal[key]çå¼è½¬æ¢ææ°ç»è¿å535 ret[key] = parent536 ? parent.concat(child)537 : Array.isArray(child) ? child : [child]538 }539 //è¿åè¿ä¸ªæ°å¯¹è±¡540 return ret541}542/**543 * Other object hashes.544 */545/*å并parentValåchildVal对象为ä¸ä¸ªæ°å¯¹è±¡,并对childValåæ°æ£æµæ¯å¦ä¸ºå¯¹è±¡ï¼å¦åæ¥é*/546strats.props =547strats.methods =548strats.inject =549strats.computed = function (550 parentVal: ?Object,551 childVal: ?Object,552 vm?: Component,553 key: string554): ?Object {555 //åæ°childValåå¨å¹¶ä¸ä¸æ¯ç产ç¯å¢ï¼æ£æµchildValæ¯å¦ä¸ºå¯¹è±¡556 if (childVal && process.env.NODE_ENV !== 'production') {557 assertObjectType(key, childVal, vm)558 }559 //ä¸åå¨parentValåæ°ï¼ç´æ¥è¿åchildVal560 if (!parentVal) return childVal561 const ret = Object.create(null)562 //å°parentVal对象å并å°ä¸ä¸ªåå为空ç空对象ä¸563 extend(ret, parentVal)564 //åå¨childValåæ°ï¼é£å°±å°childVal对象å并è¿ret对象565 if (childVal) extend(ret, childVal)566 return ret567}568strats.provide = mergeDataOrFn569/**570 * Validate component names571 */...
sharedUtils.js
Source:sharedUtils.js
...27 return typeof subjectVariable === 'number';28 }29}30// important - does not check for length31function assertObjectType(expectedType, subjectVariable, format) {32 switch (expectedType) {33 case 'number':34 return checkNumberTypeByFormat(subjectVariable, format);35 case 'string':36 return checkStringTypeByFormat(subjectVariable, format);37 case 'number|string':38 return checkNumberOrStringTypeByFormat(subjectVariable, format);39 case 'object':40 return typeof subjectVariable === 'object';41 case 'array':42 return Array.isArray(subjectVariable);43 case 'array:number':44 return Array.isArray(subjectVariable) && subjectVariable.filter(entry => typeof entry !== 'number').length === 0;45 case 'array:object':46 return Array.isArray(subjectVariable) && subjectVariable.filter(entry => typeof entry !== 'object').length === 0;47 default:48 return true;49 }50}51function checkArrayElements(array, name, format, {52 elementsType, length, maxLength, minLength, evenOdd,53}) {54 if (length && array.length !== length) {55 return { error: true, message: `${name} array must contain ${length} elements but instead found ${array.length}` };56 }57 if (maxLength && array.length > maxLength) {58 return { error: true, message: `${name} array must contain ${maxLength} elements at most but instead found ${array.length}` };59 }60 if (minLength && array.length < minLength) {61 return { error: true, message: `${name} array must contain at least ${minLength} elements but instead found ${array.length}` };62 }63 if (evenOdd && ((evenOdd === 'even' && array.length % 2 === 1) || (evenOdd === 'odd' && array.length % 2 === 0))) {64 return { error: true, message: `${name} array must contain an even number of elements but instead found ${array.length}` };65 }66 if (elementsType && !assertObjectType(elementsType, array, format)) {67 return { error: true, message: `${name} array contains elements of incorrect type` };68 }69 return { error: false, message: '' };70}71function checkObjectProperties(requiredProperties, subjectObject, format, entitiesType) {72 const undefinedProperties = [];73 Object.keys(requiredProperties).forEach((property) => {74 if (subjectObject[property] === undefined) {75 undefinedProperties.push(property);76 }77 });78 if (undefinedProperties.length > 0) {79 return { error: true, message: `The following ${entitiesType} have not been found: ${undefinedProperties.join(', ')}` };80 }81 const nullProperties = [];82 Object.keys(requiredProperties).forEach((property) => {83 if (subjectObject[property] === null) {84 nullProperties.push(property);85 }86 });87 if (nullProperties.length > 0) {88 return { error: true, message: `The following ${entitiesType} are null: ${nullProperties}` };89 }90 const incorrectTypeProperties = [];91 Object.keys(requiredProperties).forEach((property) => {92 if (!assertObjectType(requiredProperties[property], subjectObject[property], format)) {93 incorrectTypeProperties.push(property);94 }95 });96 if (incorrectTypeProperties.length > 0) {97 return { error: true, message: `The following ${entitiesType} contain an incorrect type: ${incorrectTypeProperties}` };98 }99 return { error: false, message: '' };100}...
calculate-points-for-omic-workload.js
Source:calculate-points-for-omic-workload.js
...5const Workload = require('./domain/workload')6const CaseTypeWeightings = require('./domain/case-type-weightings')7const assertObjectType = require('./domain/validation/assert-object-type')8module.exports = function (workload, caseTypeWeightings, t2aCaseTypeWeightings) {9 assertObjectType(workload, Workload, 'workload')10 assertObjectType(caseTypeWeightings, CaseTypeWeightings, 'CaseTypeWeightings')11 assertObjectType(t2aCaseTypeWeightings, CaseTypeWeightings, 'CaseTypeWeightings')12 const communityTierPoints = calculatePointsForTiers(workload.communityTiers, caseTypeWeightings.pointsConfiguration.communityTierPointsConfig, caseTypeWeightings, false)13 const custodyTierPoints = calculatePointsForTiers(workload.custodyTiers, caseTypeWeightings.pointsConfiguration.custodyTierPointsConfig, caseTypeWeightings, false)14 const licenseTierPoints = calculatePointsForTiers(workload.licenseTiers, caseTypeWeightings.pointsConfiguration.licenseTierPointsConfig, caseTypeWeightings, false)15 const projectedLicenseTierPoints = calculatePointsForTiers(workload.custodyTiers, caseTypeWeightings.pointsConfiguration.licenseTierPointsConfig, caseTypeWeightings, false)16 const t2aCommunityTierPoints = calculatePointsForTiers(workload.t2aCommunityTiers, t2aCaseTypeWeightings.pointsConfiguration.communityTierPointsConfig, t2aCaseTypeWeightings, true)17 const t2aCustodyTierPoints = calculatePointsForTiers(workload.t2aCustodyTiers, t2aCaseTypeWeightings.pointsConfiguration.custodyTierPointsConfig, t2aCaseTypeWeightings, true)18 const t2aLicenseTierPoints = calculatePointsForTiers(workload.t2aLicenseTiers, t2aCaseTypeWeightings.pointsConfiguration.licenseTierPointsConfig, t2aCaseTypeWeightings, true)19 const t2aProjectedLicenseTierPoints = calculatePointsForTiers(workload.t2aCustodyTiers, t2aCaseTypeWeightings.pointsConfiguration.licenseTierPointsConfig, t2aCaseTypeWeightings, true)20 const sdrConversionPointsLast30Days = calculateSdrConversionPoints(workload.sdrConversionsLast30Days, caseTypeWeightings.pointsConfiguration.sdrConversion)21 const monthlySdrConversionPoints = calculateSdrConversionPoints(workload.monthlySdrs, caseTypeWeightings.pointsConfiguration.sdr)22 const paromsPoints = calculateParomPoints(workload.paromsCompletedLast30Days, caseTypeWeightings.pointsConfiguration.parom, caseTypeWeightings.pointsConfiguration.paromsEnabled)23 const armsPoints = calculateArmsPoints(workload.armsLicenseCases, workload.armsCommunityCases, caseTypeWeightings.armsLicense, caseTypeWeightings.armsCommunity)24 const totalWorkloadPoints = communityTierPoints +25 custodyTierPoints +...
workload.js
Source:workload.js
...45 assertNumber(this.sdrsDueNext30Days, 'SDRs Due Next 30 Days')46 assertNumber(this.sdrConversionsLast30Days, 'SDR Conversions Last 30 Days')47 assertNumber(this.paromsCompletedLast30Days, 'PAROMS Completed Last 30 Days')48 assertNumber(this.paromsDueNext30Days, 'PAROMS Due Next 30 Days')49 assertObjectType(this.custodyTiers, Tiers, 'Custody Tiers')50 assertObjectType(this.communityTiers, Tiers, 'Community Tiers')51 assertObjectType(this.licenseTiers, Tiers, 'License Tiers')52 assertObjectType(this.t2aCustodyTiers, Tiers, 'Custody Tiers')53 assertObjectType(this.t2aCommunityTiers, Tiers, 'Community Tiers')54 assertObjectType(this.t2aLicenseTiers, Tiers, 'License Tiers')55 assertNumber(this.licenseCasesLast16Weeks, 'License Cases Last 16 Weeks')56 assertNumber(this.communityCasesLast16Weeks, 'Community Cases Last 16 Weeks')57 assertNumber(this.armsCommunityCases, 'ARMS Community Cases')58 assertNumber(this.armsLicenseCases, 'ARMS License Cases')59 assertNumber(this.stagingId, 'Staging ID')60 assertNumber(this.workloadReportId, 'Workload Report ID')61 assertObjectType(this.filteredCustodyTiers, Tiers, 'Filtered Custody Tiers')62 assertObjectType(this.filteredCommunityTiers, Tiers, 'Filtered Community Tiers')63 assertObjectType(this.filteredLicenseTiers, Tiers, 'Filtered License Tiers')64 assertNumber(this.totalFilteredCases, 'Total Filtered Cases')65 }66}...
calculate-points-for-workload.js
Source:calculate-points-for-workload.js
...5const Workload = require('../../app/points/domain/workload')6const CaseTypeWeightings = require('../../app/points/domain/case-type-weightings')7const assertObjectType = require('../../app/points/domain/validation/assert-object-type')8module.exports = function (workload, caseTypeWeightings, t2aCaseTypeWeightings) {9 assertObjectType(workload, Workload, 'workload')10 assertObjectType(caseTypeWeightings, CaseTypeWeightings, 'CaseTypeWeightings')11 assertObjectType(t2aCaseTypeWeightings, CaseTypeWeightings, 'CaseTypeWeightings')12 const communityTierPoints = calculatePointsForTiers(workload.filteredCommunityTiers, caseTypeWeightings.pointsConfiguration.communityTierPointsConfig, caseTypeWeightings, false)13 const custodyTierPoints = calculatePointsForTiers(workload.filteredCustodyTiers, caseTypeWeightings.pointsConfiguration.custodyTierPointsConfig, caseTypeWeightings, false)14 const licenseTierPoints = calculatePointsForTiers(workload.filteredLicenseTiers, caseTypeWeightings.pointsConfiguration.licenseTierPointsConfig, caseTypeWeightings, false)15 const t2aCommunityTierPoints = calculatePointsForTiers(workload.t2aCommunityTiers, t2aCaseTypeWeightings.pointsConfiguration.communityTierPointsConfig, t2aCaseTypeWeightings, true)16 const t2aCustodyTierPoints = calculatePointsForTiers(workload.t2aCustodyTiers, t2aCaseTypeWeightings.pointsConfiguration.custodyTierPointsConfig, t2aCaseTypeWeightings, true)17 const t2aLicenseTierPoints = calculatePointsForTiers(workload.t2aLicenseTiers, t2aCaseTypeWeightings.pointsConfiguration.licenseTierPointsConfig, t2aCaseTypeWeightings, true)18 const sdrConversionPointsLast30Days = calculateSdrConversionPoints(workload.sdrConversionsLast30Days, caseTypeWeightings.pointsConfiguration.sdrConversion)19 const monthlySdrConversionPoints = calculateSdrConversionPoints(workload.monthlySdrs, caseTypeWeightings.pointsConfiguration.sdr)20 const paromsPoints = calculateParomPoints(workload.paromsCompletedLast30Days, caseTypeWeightings.pointsConfiguration.parom, caseTypeWeightings.pointsConfiguration.paromsEnabled)21 const armsPoints = calculateArmsPoints(workload.armsLicenseCases, workload.armsCommunityCases, caseTypeWeightings.armsLicense, caseTypeWeightings.armsCommunity)22 const totalWorkloadPoints = communityTierPoints +23 custodyTierPoints +24 licenseTierPoints +25 t2aCommunityTierPoints +...
tiers.js
Source:tiers.js
...25 this.total = total26 this.isValid()27 }28 isValid () {29 assertObjectType(this.a3, TierCounts, 'TierCounts a3')30 assertObjectType(this.a2, TierCounts, 'TierCounts a2')31 assertObjectType(this.a1, TierCounts, 'TierCounts a1')32 assertObjectType(this.a0, TierCounts, 'TierCounts a0')33 assertObjectType(this.b3, TierCounts, 'TierCounts b3')34 assertObjectType(this.b2, TierCounts, 'TierCounts b2')35 assertObjectType(this.b1, TierCounts, 'TierCounts b1')36 assertObjectType(this.b0, TierCounts, 'TierCounts b0')37 assertObjectType(this.c3, TierCounts, 'TierCounts c3')38 assertObjectType(this.c2, TierCounts, 'TierCounts c2')39 assertObjectType(this.c1, TierCounts, 'TierCounts c1')40 assertObjectType(this.c0, TierCounts, 'TierCounts c0')41 assertObjectType(this.d3, TierCounts, 'TierCounts d3')42 assertObjectType(this.d2, TierCounts, 'TierCounts d2')43 assertObjectType(this.d1, TierCounts, 'TierCounts d1')44 assertObjectType(this.d0, TierCounts, 'TierCounts d0')45 assertObjectType(this.untiered, TierCounts, 'TierCounts untiered')46 assertLocation(this.location, 'location')47 }48 getTiersAsList () {49 const list = [50 this.a3, // Tier 151 this.a2, // Tier 252 this.a1, // Tier 353 this.a0, // Tier 454 this.b3, // Tier 555 this.b2, // Tier 656 this.b1, // Tier 757 this.b0, // Tier 858 this.c3, // Tier 959 this.c2, // Tier 10...
points-configuration.js
Source:points-configuration.js
...19 this.parom = parom20 this.isValid()21 }22 isValid () {23 assertObjectType(this.communityTierPointsConfig, LocationPointsConfiguration, 'Community Tier Points Config')24 assertObjectType(this.licenseTierPointsConfig, LocationPointsConfiguration, 'License Tier Points Config')25 assertObjectType(this.custodyTierPointsConfig, LocationPointsConfiguration, 'Custody Tier Points Config')26 assertNumber(this.sdr, 'SDR')27 assertNumber(this.sdrConversion, 'SDR Conversion')28 assertObjectType(this.defaultNominalTargets, DefaultNominalTargets, 'Default Nominal Targets')29 assertObjectType(this.defaultContractedHours, DefaultContractedHours, 'Default Contracted Hours')30 assertNumber(this.parom, 'Parom')31 assertBoolean(this.paromsEnabled, 'Paroms')32 }33}...
calculate-points-for-tiers.js
Source:calculate-points-for-tiers.js
...3const Tiers = require('../../app/points/domain/tiers')4const LocationPointsConfiguration = require('../../app/points/domain/location-points-configuration')5const assertObjectType = require('../../app/points/domain/validation/assert-object-type')6module.exports = function (locationTiers, locationPointsConfiguration, caseTypeWeightings, subtractInactiveCases = false) {7 assertObjectType(locationTiers, Tiers, 'Tiers')8 assertObjectType(locationPointsConfiguration, LocationPointsConfiguration, 'LocationPointsConfiguration')9 assertObjectType(caseTypeWeightings, CaseTypeWeightings, 'CaseTypeWeightings')10 let points = 011 const tiersPointConfigurationAsList = locationPointsConfiguration.asTierList()12 const tiers = locationTiers.getTiersAsList()13 // purposely leave out the untiered cases14 for (let i = 0; i < tiers.length - 1; i++) {15 points += calculatePointsForTier(tiers[i], tiersPointConfigurationAsList[i], caseTypeWeightings, subtractInactiveCases)16 }17 return points...
Using AI Code Generation
1const { assertObjectType } = require('playwright/lib/utils/utils');2const { Page } = require('playwright/lib/server/page');3const { ElementHandle } = require('playwright/lib/server/dom');4const { JSHandle } = require('playwright/lib/server/jsHandle');5const page = new Page();6const elementHandle = new ElementHandle(page, 'elementHandle', null, null);7const jsHandle = new JSHandle(page, 'jsHandle', null, null);8assertObjectType(page, Page, 'page');9assertObjectType(elementHandle, ElementHandle, 'elementHandle');10assertObjectType(jsHandle, JSHandle, 'jsHandle');11assertObjectType(page, ElementHandle, 'page');12assertObjectType(elementHandle, Page, 'elementHandle');13assertObjectType(jsHandle, ElementHandle, 'jsHandle');14assertObjectType(jsHandle, Page, 'jsHandle');
Using AI Code Generation
1const assertObjectType = require('@playwright/test/lib/utils/utils').assertObjectType;2const createTestFixtures = require('@playwright/test/lib/test').createTestFixtures;3const TestType = require('@playwright/test/lib/test').TestType;4const Playwright = require('@playwright/test/lib/server/playwright');5const PlaywrightServer = require('@playwright/test/lib/server/playwrightServer');6const PlaywrightDispatcher = require('@playwright/test/lib/server/playwrightDispatcher');7const PlaywrightServerController = require('@playwright/test/lib/server/playwrightServerController');8const PlaywrightServerDispatcher = require('@playwright/test/lib/server/playwrightServerDispatcher');9const PlaywrightServerTransport = require('@playwright/test/lib/server/playwrightServerTransport');10const PlaywrightServerWorker = require('@playwright/test/lib/server/playwrightServerWorker');11const PlaywrightServerWorkerDispatcher = require('@playwright/test/lib/server/playwrightServerWorkerDispatcher');12const PlaywrightServerWorkerTransport = require('@playwright/test/lib/server/playwrightServerWorkerTransport');13const PlaywrightServerWorkerChannel = require('@playwright/test/lib/server/playwrightServerWorkerChannel');14const PlaywrightServerChannel = require('@playwright/test/lib/server/playwrightServerChannel');15const PlaywrightServerProcess = require('@playwright/test/lib/server/playwrightServerProcess');16const PlaywrightServerProcessDispatcher = require('@playwright/test/lib/server/playwrightServerProcessDispatcher');
Using AI Code Generation
1const { assertObjectType } = require('playwright-core/lib/server/frames');2const { assertObjectType } = require('playwright-core/lib/server/frames');3const { assertObjectType } = require('playwright-core/lib/server/frames');4assertObjectType(object, type, description, options);5const { assertObjectType } = require('playwright-core/lib/server/frames');6const { assert } = require('console');7let object = {a: 'a', b: 'b', c: 'c'};8let type = 'object';9let description = 'object';10let options = {allowExtraKeys: true, allowNull: true, allowUndefined: true};11assertObjectType(object, type, description, options);12assertObjectType(object, type, description, options);
Using AI Code Generation
1const assert = require('assert');2const playwright = require('playwright');3const path = require('path');4const fs = require('fs');5const test = async () => {6 const browser = await playwright.chromium.launch({7 });8 const context = await browser.newContext();9 const page = await context.newPage();10 const { assertObjectType } = require('playwright/lib/server/chromium/crBrowser');11 const obj = { a: 1 };12 assertObjectType(obj, 'object');13 await browser.close();14};15test();16const assert = require('assert');17const playwright = require('playwright');18const path = require('path');19const fs = require('fs');20const test = async () => {21 const browser = await playwright.chromium.launch({22 });23 const context = await browser.newContext();24 const page = await context.newPage();25 const { assertObjectType } = require('playwright/lib/server/chromium/crBrowser');26 const obj = { a: 1 };27 assertObjectType(obj, 'object');28 await browser.close();29};30test();31const assert = require('assert');32const playwright = require('playwright');33const path = require('path');34const fs = require('fs');35const test = async () => {36 const browser = await playwright.chromium.launch({37 });38 const context = await browser.newContext();39 const page = await context.newPage();40 const { assertObjectType } = require('playwright/lib/server/chromium/crBrowser');41 const obj = { a: 1 };42 assertObjectType(obj, 'object');43 await browser.close();44};45test();46const assert = require('
Using AI Code Generation
1const { assertObjectType } = require('playwright-core/lib/server/supplements/utils/stackTrace');2const assert = require('assert');3const { Page } = require('playwright-core/lib/server/page');4const { Frame } = require('playwright-core/lib/server/frame');5const obj = new Page(null, null, null, null);6const objType = 'Page';7assertObjectType(obj, objType, 'obj');8const obj1 = new Frame(null, null, null, null);9const objType1 = 'Frame';10assertObjectType(obj1, objType1, 'obj1');11 at assertObjectType (C:\Users\username\playwright\playwright-core\lib\server\supplements\utils\stackTrace.js:11:11)12 at Object.<anonymous> (C:\Users\username\playwright\test.js:11:5)13 at Module._compile (internal/modules/cjs/loader.js:1137:30)14 at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)15 at Module.load (internal/modules/cjs/loader.js:985:32)16 at Function.Module._load (internal/modules/cjs/loader.js:878:14)17 at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)18 at assertObjectType (C:\Users\username\playwright\playwright-core\lib\server\supplements\utils\stackTrace.js:11:11)19 at Object.<anonymous> (C:\Users\username\playwright\test.js:18:5)20 at Module._compile (internal/modules/cjs/loader.js:1137:30)21 at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)22 at Module.load (internal/modules/cjs/loader.js:985:32)23 at Function.Module._load (internal/modules/cjs/loader.js:878:14)
Using AI Code Generation
1const { assertObjectType } = require('@playwright/test/lib/utils');2const obj = {3 address: {4 },5};6assertObjectType(obj, 'obj', {7 address: {8 },9});10assertObjectType(obj, 'obj', {11});12assertObjectType(obj, 'obj', {13 address: {14 },15});16assertObjectType(obj, 'obj', {17 address: {18 },19});20assertObjectType(obj, 'obj', {21 address: {22 zip: {23 },24 },25});26assertObjectType(obj, 'obj', {27 address: {28 zip: {29 },30 },31});32assertObjectType(obj, 'obj', {33 address: {34 zip: {35 },36 },37 country: {38 },39});40assertObjectType(obj, 'obj', {41 address: {42 zip: {43 },44 },45 country: {46 },47});48assertObjectType(obj, 'obj', {
Using AI Code Generation
1const assertObjectType = require('@playwright/test').internal.assertObjectType;2const assertType = require('@playwright/test').internal.assertType;3const expect = require('@playwright/test').internal.expect;4const expectType = require('@playwright/test').internal.expectType;5const { test, expect } = require('@playwright/test');6test('test', async ({ page }) => {7 assertObjectType(page, 'page', ['Page']);8 assertType(page, 'page', 'object');9 expect(page).toBe('object');10 expectType(page).toBe('object');11});
Using AI Code Generation
1const { assertObjectType } = require('playwright-core/lib/utils/utils');2const { assert } = require('console');3assertObjectType(object, 'object', 'test', 'test');4assert(object, 'object', 'test', 'test');5import { assertObjectType } from 'playwright-core/lib/utils/utils';6import { assert } from 'assert';7assertObjectType(object, 'object', 'test', 'test');8assert(object, 'object', 'test', 'test');
Using AI Code Generation
1const { assertObjectType } = require('playwright/lib/client/helper');2const { assert } = require('console');3async function main() {4 try {5 assertObjectType('string', 10, 'test');6 } catch (error) {7 assert(error.message === 'test: expected string, got number');8 }9 assertObjectType('number', 10, 'test');10}11main();
LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.
Get 100 minutes of automation test minutes FREE!!