Skip to content
This repository has been archived by the owner on May 10, 2021. It is now read-only.

Commit

Permalink
Replace karma with jest (#182)
Browse files Browse the repository at this point in the history
* add jest for web3 tests

* ethereum tests working

* Connect tests working

* subprovider tests working

* all tests passing with jest

* tests on the CI working

* delete old, karma-related files
  • Loading branch information
c-castillo authored and localredhead committed Aug 6, 2018
1 parent 87af8dd commit 748d0ff
Show file tree
Hide file tree
Showing 26 changed files with 7,242 additions and 6,815 deletions.
34 changes: 34 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
version: 2
jobs:
build:
working_directory: ~/uport-connect
docker:
- image: circleci/node:8-browsers
steps:
- checkout

# Download and cache dependencies
- restore_cache:
keys:
- dependencies-cache-{{ checksum "package.json" }}

- run:
name: install-dependencies
command: yarn

- run:
name: test
command: npm run test:jest

- run:
name: code-coverage
command: bash <(curl -s https://codecov.io/bash)

- run:
name: dist
command: npm run build-dist && npm run build-dist-prod

- save_cache:
key: dependency-cache-{{ checksum "package.json" }}
paths:
- ./node_modules
25 changes: 25 additions & 0 deletions __tests__/Connect.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Connect } from "../src/index";
import { Credentials } from "uport";

describe("Connect", () => {
describe("config", () => {
it("defaults", () => {
const uport = new Connect("test app");
expect(uport.appName).toEqual("test app");
expect(uport.infuraApiKey).toEqual("test-app");
expect(uport.uriHandler.name).toEqual("openQr");
expect(uport.network.id).toEqual("0x4");
expect(uport.closeUriHandler.name).toEqual("closeQr");
expect(uport.credentials).toBeInstanceOf(Credentials);
expect(uport.canSign).toBeFalsy();
expect(uport.getWeb3).toBeDefined();
});

it("does not have a closeUriHandler if not using built in openQr", () => {
const noop = uri => null;
const uport = new Connect("test", { uriHandler: noop });
expect(uport.uriHandler).toEqual(noop);
expect(uport.closeUriHandler).toBeUndefined();
});
});
});
Loading

0 comments on commit 748d0ff

Please sign in to comment.