-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cddc615
commit f037bdc
Showing
12 changed files
with
232 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import * as apiExternal from "@shared/api/external"; | ||
import { signBlob } from "../signBlob"; | ||
|
||
describe("signBlob", () => { | ||
it("returns a signed blob", async () => { | ||
const TEST_BLOB = atob("AAA"); | ||
apiExternal.submitBlob = jest.fn().mockReturnValue(TEST_BLOB); | ||
const blob = await signBlob(); | ||
expect(blob).toBe(TEST_BLOB); | ||
}); | ||
it("throws a generic error", () => { | ||
const TEST_ERROR = "Error!"; | ||
apiExternal.submitBlob = jest.fn().mockImplementation(() => { | ||
throw TEST_ERROR; | ||
}); | ||
expect(signBlob).toThrowError(TEST_ERROR); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { submitBlob } from "@shared/api/external"; | ||
import { isBrowser } from "."; | ||
|
||
export const signBlob = ( | ||
blob: string, | ||
opts: { | ||
network: string; | ||
networkPassphrase: string; | ||
accountToSign: string; | ||
} | ||
): Promise<string> => | ||
isBrowser ? submitBlob(blob, opts) : Promise.resolve(""); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.