diff options
| author | Dmitry Sharshakov <sh7dm@outlook.com> | 2019-03-05 02:23:04 +0300 |
|---|---|---|
| committer | Ryan Dahl <ry@tinyclouds.org> | 2019-03-04 18:23:04 -0500 |
| commit | 9f33cd28963a72d8fea0b1e99bb61ca9bec21a94 (patch) | |
| tree | 29b8b1bb8debadf3a92f900ea51d7979550697ac /ws/sha1_test.ts | |
| parent | ce7a987009aed294d336dc420b72743ecd51db89 (diff) | |
Refactor WebSockets (denoland/deno_std#173)
* Use assert.equal instead of deprecated assertEqual
* Replace let with const where possible
* Add WebSocketMessage type
* Use OpCode in WebSocketFrame
* Use const where possible in WS
* Separate sha1 tests, use const instead of let
Original: https://github.com/denoland/deno_std/commit/385f866a545176261806d75184e2ef97fa0d5269
Diffstat (limited to 'ws/sha1_test.ts')
| -rw-r--r-- | ws/sha1_test.ts | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/ws/sha1_test.ts b/ws/sha1_test.ts index 865e443e5..fb6b7c13e 100644 --- a/ws/sha1_test.ts +++ b/ws/sha1_test.ts @@ -3,16 +3,21 @@ import { assert, test } from "../testing/mod.ts"; import { Sha1 } from "./sha1.ts"; test(function testSha1() { - let sha1 = new Sha1(); + const sha1 = new Sha1(); sha1.update("abcde"); assert.equal(sha1.toString(), "03de6c570bfe24bfc328ccd7ca46b76eadaf4334"); +}); +test(function testSha1WithArray() { const data = Uint8Array.of(0x61, 0x62, 0x63, 0x64, 0x65); - sha1 = new Sha1(); + const sha1 = new Sha1(); sha1.update(data); assert.equal(sha1.toString(), "03de6c570bfe24bfc328ccd7ca46b76eadaf4334"); +}); - sha1 = new Sha1(); +test(function testSha1WithBuffer() { + const data = Uint8Array.of(0x61, 0x62, 0x63, 0x64, 0x65); + const sha1 = new Sha1(); sha1.update(data.buffer); assert.equal(sha1.toString(), "03de6c570bfe24bfc328ccd7ca46b76eadaf4334"); }); |
