Skip to content

Commit 0dd2c0d

Browse files
committed
🧪 test: merge test files
1 parent fc11ea2 commit 0dd2c0d

File tree

3 files changed

+71
-83
lines changed

3 files changed

+71
-83
lines changed

__tests__/cli.test.ts

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,75 @@ describe('[CLI]', () => {
1515
expect(output).toContain(version);
1616
});
1717
});
18+
19+
describe('[Commands: generate page component]', () => {
20+
afterEach(() => {
21+
filesystem.remove('sample');
22+
});
23+
24+
test('should generate a page component with 3 files', async () => {
25+
await cli('g c p sample');
26+
27+
const html = filesystem.read('sample/sample.page.html');
28+
const scss = filesystem.read('sample/sample.page.scss');
29+
const ts = filesystem.read('sample/sample.page.ts');
30+
31+
expect(html).toBeDefined();
32+
expect(scss).toBeDefined();
33+
expect(ts).toBeDefined();
34+
});
35+
36+
test('should generate a page component html with default template <p>sample works</p>', async () => {
37+
await cli('g c p sample');
38+
39+
const html = filesystem.read('sample/sample.page.html');
40+
expect(html).toContain('<p>sample works</p>');
41+
});
42+
43+
test('should generate a page component with correct templateUrl: and styleUrls ', async () => {
44+
await cli('g c p sample');
45+
46+
const ts = filesystem.read('sample/sample.page.ts');
47+
48+
expect(ts).toContain(`templateUrl: './sample.page.html'`);
49+
expect(ts).toContain(`styleUrls: ['./sample.page.scss']`);
50+
});
51+
});
52+
53+
describe('[Commands: generate widget component]', () => {
54+
afterEach(() => {
55+
filesystem.remove('sample');
56+
});
57+
58+
test('should generate widget component with 4 files', async () => {
59+
await cli('g c w sample');
60+
61+
const html = filesystem.read('sample/sample.component.html');
62+
const scss = filesystem.read('sample/sample.component.scss');
63+
const ts = filesystem.read('sample/sample.component.ts');
64+
const widgetModule = filesystem.read('sample/sample.widget.module.ts');
65+
66+
expect(html).toBeDefined();
67+
expect(scss).toBeDefined();
68+
expect(ts).toBeDefined();
69+
expect(widgetModule).toBeDefined();
70+
});
71+
72+
test('should generate widget component html with default template <p>sample works</p>', async () => {
73+
await cli('g c w sample');
74+
75+
const html = filesystem.read('sample/sample.component.html');
76+
77+
expect(html).toContain('<p>sample works</p>');
78+
});
79+
80+
test('should generate a widget component with correct templateUrl: and styleUrls ', async () => {
81+
await cli('g c w sample');
82+
83+
const ts = filesystem.read('sample/sample.component.ts');
84+
85+
expect(ts).toContain(`templateUrl: './sample.component.html'`);
86+
expect(ts).toContain(`styleUrls: ['./sample.component.scss']`);
87+
});
88+
});
1889
});

__tests__/page.command.test.ts

Lines changed: 0 additions & 40 deletions
This file was deleted.

__tests__/widget.command.test.ts

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)