Skip to content

Instantly share code, notes, and snippets.

@gparlakov
Last active November 18, 2021 05:09
Show Gist options
  • Save gparlakov/0b9b94f8140687bb3b1db1772503bd0d to your computer and use it in GitHub Desktop.
Save gparlakov/0b9b94f8140687bb3b1db1772503bd0d to your computer and use it in GitHub Desktop.
A function template example for scuri (use with config or --functionTemplate my/path/to/function.template)
This template demostrates how to apply functions to the file name.
Functions from https://github.com/angular/angular-cli/blob/master/packages/angular_devkit/core/src/utils/strings.ts
/**
* CUSTOM FUNCTION TEMPLATE
* AVAILABLE PROPERTIES:
* specFileName: <%= specFileName %>
* normalizedName: <%= normalizedName %> (fileName.ext) ->normalize-> fileName
* name: <%= name %>
*/
describe('<%= name %> (is a function!)', () => {
it('should mostly work', () => {
const result = <%= name %>();
expect(result).toBe(42);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment