Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

Commit

Permalink
fix test; fix facade semantics
Browse files Browse the repository at this point in the history
  • Loading branch information
Morley Zhi committed Jan 7, 2020
1 parent e89075a commit a1ac23a
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 24 deletions.
9 changes: 7 additions & 2 deletions src/plugins/LocalStorageFacade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@ export interface LocalStorageConfigParams {
* local storage
*/
export class LocalStorageFacade {
private storage: Storage | null = null;
private prefix: string = "stellarkeys";
private storage: Storage | null;
private prefix: string;

constructor() {
this.storage = null;
this.prefix = "stellarkeys";
}

public configure(params: LocalStorageConfigParams) {
Object.assign(this, params);
Expand Down
52 changes: 30 additions & 22 deletions src/transfers/DepositProvider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,28 +92,36 @@ describe("watchOneTransaction", () => {
// suite-wide consts
const transferServer = "https://www.stellar.org/transfers";

const pendingTransaction = (n: number = 0): Transaction => {
const pendingTransaction = (n: number = 0): { transaction: Transaction } => {
return {
kind: "deposit",
id: "TEST",
status: TransactionStatus.pending_anchor,
status_eta: n,
transaction: {
kind: "deposit",
id: "TEST",
status: TransactionStatus.pending_anchor,
status_eta: n,
},
};
};
const successfulTransaction = (n: number = 0): Transaction => {
const successfulTransaction = (
n: number = 0,
): { transaction: Transaction } => {
return {
kind: "deposit",
id: "TEST",
status: TransactionStatus.completed,
status_eta: n,
transaction: {
kind: "deposit",
id: "TEST",
status: TransactionStatus.completed,
status_eta: n,
},
};
};
const failedTransaction = (n: number = 0): Transaction => {
const failedTransaction = (n: number = 0): { transaction: Transaction } => {
return {
kind: "deposit",
id: "TEST",
status: TransactionStatus.error,
status_eta: n,
transaction: {
kind: "deposit",
id: "TEST",
status: TransactionStatus.error,
status_eta: n,
},
};
};

Expand Down Expand Up @@ -156,7 +164,7 @@ describe("watchOneTransaction", () => {
// start watching
provider.watchOneTransaction({
asset_code: "SMX",
id: successfulTransaction(0).id,
id: successfulTransaction(0).transaction.id,
onMessage,
onSuccess,
onError,
Expand Down Expand Up @@ -190,7 +198,7 @@ describe("watchOneTransaction", () => {
// start watching
provider.watchOneTransaction({
asset_code: "SMX",
id: successfulTransaction(0).id,
id: successfulTransaction(0).transaction.id,
onMessage,
onSuccess,
onError,
Expand Down Expand Up @@ -224,7 +232,7 @@ describe("watchOneTransaction", () => {
// start watching
provider.watchOneTransaction({
asset_code: "SMX",
id: successfulTransaction(0).id,
id: successfulTransaction(0).transaction.id,
onMessage,
onSuccess,
onError,
Expand Down Expand Up @@ -263,7 +271,7 @@ describe("watchOneTransaction", () => {
// start watching
provider.watchOneTransaction({
asset_code: "SMX",
id: successfulTransaction(0).id,
id: successfulTransaction(0).transaction.id,
onMessage,
onSuccess,
onError,
Expand Down Expand Up @@ -315,7 +323,7 @@ describe("watchOneTransaction", () => {
// start watching
provider.watchOneTransaction({
asset_code: "SMX",
id: successfulTransaction(0).id,
id: successfulTransaction(0).transaction.id,
onMessage,
onSuccess,
onError,
Expand Down Expand Up @@ -375,7 +383,7 @@ describe("watchOneTransaction", () => {
// start watching
provider.watchOneTransaction({
asset_code: "SMX",
id: successfulTransaction(0).id,
id: successfulTransaction(0).transaction.id,
onMessage,
onSuccess,
onError,
Expand Down Expand Up @@ -436,7 +444,7 @@ describe("watchOneTransaction", () => {
// start watching
provider.watchOneTransaction({
asset_code: "SMX",
id: successfulTransaction(0).id,
id: successfulTransaction(0).transaction.id,
onMessage,
onSuccess,
onError,
Expand Down

0 comments on commit a1ac23a

Please sign in to comment.