Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update testing reference guide #435

Merged
merged 6 commits into from Jul 13, 2019
Merged

Conversation

agubler
Copy link
Member

@agubler agubler commented Jul 8, 2019

Type: feature

The following has been addressed in the PR:

Description:

Update the testing reference guide with new APIs and features for supporting mock middleware.

@agubler agubler requested review from dylans, odoe and sbinge July 8, 2019 09:23
@@ -243,56 +389,6 @@ v('div', {
])
```

### `harness.expectPartial`
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this because we don't really want to promote its use. With assertion templates it has become less useful as the templates can be easily manipulated but still test the whole widget.

docs/en/testing/basic-usage.md Outdated Show resolved Hide resolved
docs/en/testing/supplemental.md Outdated Show resolved Hide resolved

##### Mock `node` Middleware

Using `createMockNodeMiddleware` from `@dojo/framework/testing/mocks/middleware/node` creates a mock node middleware. To set the expected return from the node mock, call the `mockNode` with a `key` and expected node.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that node could mean a DOM Node or Node.js, I think the first instance of this should be more specific, e.g. creates a mock middleware for a DOM node.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

urgh the middleware is called node though.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it's not a mock middleware for a "DOM nodeit's a mock middleware for thenode` middleware. So think I'm going to leave it as it is.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest "creates a mock for the node middleware" for ease of reading comprehension.

docs/en/testing/supplemental.md Show resolved Hide resolved
docs/en/testing/supplemental.md Outdated Show resolved Hide resolved
docs/en/testing/supplemental.md Outdated Show resolved Hide resolved
docs/en/testing/supplemental.md Outdated Show resolved Hide resolved
docs/en/testing/supplemental.md Outdated Show resolved Hide resolved
});
h.expect(/* assertion template for `Loading`*/);

// would be useful to assert the calls to processes effectively stubbed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment seems a bit weird to be in the docs as it feels more like an internal todo

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

old comment, good catch.

docs/en/testing/supplemental.md Outdated Show resolved Hide resolved
Copy link
Contributor

@odoe odoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet! Just the one line to remove I think!

```bash
TESTINGBOT_SECRET=<secret> TESTINGBOT_KEY=<key> dojo test -a -c saucelabs
```
Using the `setChildren` method of an Assertion Template with the `~key` value you assigned will return a assertion template with the updated virtual DOM structure that you can test your widget output against.

[browserstack]: https://www.browserstack.com/
Copy link
Contributor

@odoe odoe Jul 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove this browserstack ref since it's not referenced in this doc anymore.

@agubler agubler changed the title [WIP] Update testing reference guide Update testing reference guide Jul 9, 2019
@agubler agubler merged commit e0166b5 into dojo:master Jul 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants