Skip to content

Commit

Permalink
better example
Browse files Browse the repository at this point in the history
  • Loading branch information
bahmutov committed May 2, 2023
1 parent c9886a7 commit 6b39f79
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
10 changes: 6 additions & 4 deletions docs/recipes/sha-256.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,12 @@ The page does change and the element's HTML has a new SHA, but is this a good te
SHA code changes even when the only changes are invisible to the user, like whitespace around elements.

```js
expect(
digestMessage('<div>Hello</div>'),
'extra space at the end',
).to.not.equal(digestMessage('<div>Hello</div> '))
cy.log('a space at the end')
cy.wrap(digestMessage('<div>Hello</div>')).then((sha1) => {
return digestMessage('<div>Hello</div> ').then((sha2) => {
expect(sha1, 'extra space at the end').to.not.equal(sha2)
})
})
```

**Note:** there is also a subtle timing bug in the above test, something that affects every test framework that relies only on promises or `async/await` syntax to execute its commands.
Expand Down
17 changes: 10 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"lint-staged": "10.1.3",
"markdown-link-check": "3.8.1",
"pluralize": "8.0.0",
"prettier": "2.0.4",
"prettier": "2.8.8",
"semantic-release": "^17.0.7",
"shelljs": "0.8.4",
"start-server-and-test": "2.0.0",
Expand Down

0 comments on commit 6b39f79

Please sign in to comment.