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

Migrate from jasmine2-custom-message to native withContext() #954

Merged
merged 1 commit into from
May 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions custom_types/jasmine2-custom-message/index.d.ts

This file was deleted.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"cross-env": "^5.2.0",
"jasmine": "^3.3.1",
"jasmine-console-reporter": "^3.0.2",
"jasmine2-custom-message": "^0.9.1",
"karma": "^3.1.4",
"karma-chrome-launcher": "^2.2.0",
"karma-edge-launcher": "^0.4.2",
Expand Down
18 changes: 8 additions & 10 deletions packages/iov-crypto/src/secp256k1.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
/* tslint:disable:no-bitwise */
import since = require("jasmine2-custom-message");

import { Encoding } from "@iov/encoding";

import { Secp256k1 } from "./secp256k1";
Expand Down Expand Up @@ -265,8 +263,8 @@ describe("Secp256k1", () => {
const pubkey = (await Secp256k1.makeKeypair(row.privkey)).pubkey;
const messageHash = new Sha256(row.message).digest();
const isValid = await Secp256k1.verifySignature(Secp256k1Signature.fromDer(row.signature), messageHash, pubkey);
since(`(index ${index}) #{message}`)
.expect(isValid)
expect(isValid)
.withContext(`(index ${index})`)
.toEqual(true);
}
});
Expand Down Expand Up @@ -335,19 +333,19 @@ describe("Secp256k1", () => {

// verify calculated signature
const ok1 = await Secp256k1.verifySignature(calculatedSignature, messageHash, keypair.pubkey);
since(`(index ${index}) #{message}`)
.expect(ok1)
expect(ok1)
.withContext(`(index ${index})`)
.toEqual(true);

// verify original signature
const ok2 = await Secp256k1.verifySignature(Secp256k1Signature.fromDer(row.signature), messageHash, keypair.pubkey);
since(`(index ${index}) #{message}`)
.expect(ok2)
expect(ok2)
.withContext(`(index ${index})`)
.toEqual(true);

// compare signatures
since(`(index ${index}) #{message}`)
.expect(calculatedSignature.toDer())
expect(calculatedSignature.toDer())
.withContext(`(index ${index})`)
.toEqual(row.signature);
}
});
Expand Down
5 changes: 0 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3773,11 +3773,6 @@ jasmine-core@^3.3, jasmine-core@~3.3.0:
resolved "https://registry.yarnpkg.com/jasmine-core/-/jasmine-core-3.3.0.tgz#dea1cdc634bc93c7e0d4ad27185df30fa971b10e"
integrity sha512-3/xSmG/d35hf80BEN66Y6g9Ca5l/Isdeg/j6zvbTYlTzeKinzmaTM4p9am5kYqOmE05D7s1t8FGjzdSnbUbceA==

jasmine2-custom-message@^0.9.1:
version "0.9.3"
resolved "https://registry.yarnpkg.com/jasmine2-custom-message/-/jasmine2-custom-message-0.9.3.tgz#d4afa636549c0ad345d384a81d167aec9a7dfc3d"
integrity sha512-ImGW7VN9GDDPpZCwuNEpipf4cFxg7k802GN82AnesziKNPmcYwxbh4lSVcu7LqHQoVnwORDBqX3vjYKKmOzdOw==

jasmine@^3.3.1:
version "3.3.1"
resolved "https://registry.yarnpkg.com/jasmine/-/jasmine-3.3.1.tgz#d61bb1dd8888859bd11ea83074a78ee13d949905"
Expand Down