-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy path__specFileName__.template
40 lines (37 loc) · 1.02 KB
/
__specFileName__.template
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<% params.forEach(p => { if(p.importPath) {%>import { <%= p.type %> } from '<%= p.importPath %>';
<% }}) %>import { <%= className %> } from './<%= normalizedName %>';
describe('<%= className %>', () => {
<% publicMethods.forEach(meth=> {if(meth != '') { %>it('when <%= meth %> is called it should', () => {
// arrange
const { build } = setup().default();
const <%= shorthand %> = build();
// act
<%= shorthand %>.<%= meth %>();
// assert
// expect(<%= shorthand %>).toEqual
});
<% } else { %>
it('it should construct', () => {
// arrange
const { build } = setup().default();
// act
const <%= shorthand %> = build();
// assert
// expect(<%= shorthand %>).toEqual
});
<% }}) %>
});
function setup() {
<%= declaration %>
const builder = {
<%= builderExports %>
<% setupMethods.forEach(m => {%><%= m('\n ') %><%}) %>
default() {
return builder;
},
build() {
return new <%= className %>(<%= constructorParams %>);
}
};
return builder;
}