MCPcopy
hub / github.com/angular/angular / compare

Function compare

packages/examples/upgrade/static/ts/lite/e2e_test/e2e_util.ts:26–47  ·  view source on GitHub ↗
(actualNg1Hero: ElementFinder | undefined)

Source from the content-addressed store, hash-verified

24 jasmine.addMatchers({
25 toBeAHero: () => ({
26 compare(actualNg1Hero: ElementFinder | undefined) {
27 const getText = (selector: string) => actualNg1Hero!.element(by.css(selector)).getText();
28 const result = {
29 message: 'Expected undefined to be an `ng1Hero` ElementFinder.',
30 pass:
31 !!actualNg1Hero &&
32 Promise.all(['.title', 'h2', 'p'].map(getText) as PromiseLike<string>[]).then(
33 ([actualTitle, actualName, actualDescription]) => {
34 const pass =
35 actualTitle === 'Super Hero' &&
36 isTitleCased(actualName) &&
37 actualDescription.length > 0;
38
39 const actualHero = `Hero(${actualTitle}, ${actualName}, ${actualDescription})`;
40 result.message = `Expected ${actualHero}'${pass ? ' not' : ''} to be a real hero.`;
41
42 return pass;
43 },
44 ),
45 };
46 return result;
47 },
48 }),
49 toHaveName: () => ({
50 compare(actualNg1Hero: ElementFinder | undefined, expectedName: string) {

Callers

nothing calls this directly

Calls 7

isTitleCasedFunction · 0.85
mapMethod · 0.80
getTextMethod · 0.80
elementMethod · 0.80
cssMethod · 0.80
thenMethod · 0.65
allMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…