hunk.code_window:     expect(fileString).not.toContain('CanLoad');
       expect(fileString).not.toContain('canLoad');
     });
     it('should generate a helper function to execute the guard in a test', async () => {
       const options = { ...defaultOptions, guardType: 'canActivate' };
       const tree = await schematicRunner.runSchematicAsync('guard', options, appTree).toPromise();
       const fileString = tree.readContent('/projects/bar/src/app/foo.guard.spec.ts');
       expect(fileString).toContain('const executeGuard: CanActivateFn = (...guardParameters) => ');
  
hunk.labels: keep keep keep keep keep replace keep keep keep
hunk.after_edit:     const options = { ...defaultOptions, implements: ['CanActivate'], functional: true };
  
hunk.file_path: packages/schematics/angular/guard/index_spec.ts
hunk.type: replace
file: /**
   * @license
   * Copyright Google LLC All Rights Reserved.
   *
   * Use of this source code is governed by an MIT-style license that can be
   * found in the LICENSE file at https://angular.io/license
   */
  
  import { Rule, SchematicsException } from '@angular-devkit/schematics';
  
  import { generateFromFiles } from '../utility/generate-from-files';
  
  import { Implement as GuardInterface, Schema as GuardOptions } from './schema';
  
  export default function (options: GuardOptions): Rule {
    if (options.implements && options.implements.length > 0 && options.guardType) {
      throw new SchematicsException('Options "implements" and "guardType" cannot be used together.');
    }
  
    if (options.guardType) {
      const guardType = options.guardType.replace(/^can/, 'Can') + 'Fn';
  
      return generateFromFiles({ ...options, templateFilesDirectory: './type-files' }, { guardType });
    } else {
      if (!options.implements || options.implements.length < 1) {
        options.implements = [GuardInterface.CanActivate];
      }
  
      const implementations = options.implements
        .map((implement) => (implement === 'CanDeactivate' ? 'CanDeactivate<unknown>' : implement))
        .join(', ');
      const commonRouterNameImports = ['ActivatedRouteSnapshot', 'RouterStateSnapshot'];
      const routerNamedImports: string[] = [...options.implements, 'UrlTree'];
  
      if (
        options.implements.includes(GuardInterface.CanLoad) ||
        options.implements.includes(GuardInterface.CanMatch)
      ) {
        routerNamedImports.push('Route', 'UrlSegment');
  
        if (options.implements.length > 1) {
          routerNamedImports.push(...commonRouterNameImports);
        }
      } else {
        routerNamedImports.push(...commonRouterNameImports);
      }
  
      routerNamedImports.sort();
  
      const routerImports = routerNamedImports.join(', ');
  
      return generateFromFiles(
        { ...options, templateFilesDirectory: './implements-files' },
        {
          implementations,
          routerImports,
        },
      );
    }
  }
  