Skip to content

Commit 81d71ee

Browse files
authored
Merge pull request #17 from oslabs-beta/tutorial-testing
Add tests for tutorials
2 parents 641b52a + 9113d7a commit 81d71ee

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

src/app/__tests__/Tutorial.test.tsx

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ const props = {
1616
let currentStepIndex = 5;
1717

1818
describe('Before Tutorial is entered', () => {
19-
test('How to use button exists', () => {
19+
test('Tutorial button exists', () => {
2020
render(<Tutorial {...props} />);
2121
expect(screen.getByText('Tutorial')).toBeInTheDocument();
2222
});
2323

24-
test('User clicking "How to use" while on map tab button starts map tutorial ', () => {
24+
test('User clicking tutorial button while on map tab starts map tutorial ', () => {
2525
props.currentTabInApp = 'map';
2626

2727
render(<Tutorial {...props} />);
@@ -31,17 +31,31 @@ describe('Before Tutorial is entered', () => {
3131
).toBeInTheDocument();
3232
});
3333

34-
test('User clicking "How to use" while on performance tab button starts performance tutorial ', () => {
34+
test('User clicking tutorial button while on performance tab starts performance tutorial ', () => {
3535
props.currentTabInApp = 'performance';
3636
render(<Tutorial {...props} />);
3737
fireEvent.click(screen.getByRole('button'));
3838
expect(screen.getByText('Performance Tab')).toBeInTheDocument();
3939
});
4040

41-
test('User clicking "How to use" while on performance comparison tab, no tutorial available ', () => {
42-
props.currentTabInApp = 'performance-comparison';
43-
currentStepIndex = 1;
41+
test('User clicking tutorial button while on history tab starts history tutorial ', () => {
42+
props.currentTabInApp = 'history';
4443
render(<Tutorial {...props} />);
4544
fireEvent.click(screen.getByRole('button'));
45+
expect(screen.getByText('History Tab')).toBeInTheDocument();
46+
});
47+
48+
test('User clicking tutorial button while on web metrics tab starts web metrics tutorial ', () => {
49+
props.currentTabInApp = 'webmetrics';
50+
render(<Tutorial {...props} />);
51+
fireEvent.click(screen.getByRole('button'));
52+
expect(screen.getByText('Webmetrics Tab')).toBeInTheDocument();
53+
});
54+
55+
test('User clicking tutorial button while on tree tab starts tree tutorial ', () => {
56+
props.currentTabInApp = 'tree';
57+
render(<Tutorial {...props} />);
58+
fireEvent.click(screen.getByRole('button'));
59+
expect(screen.getByText('Tree Tab')).toBeInTheDocument();
4660
});
4761
});

0 commit comments

Comments
 (0)