Skip to content

Commit

Permalink
fix: update package, fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ieow committed Dec 22, 2023
1 parent 97946f7 commit 4540546
Show file tree
Hide file tree
Showing 5 changed files with 146 additions and 55 deletions.
152 changes: 117 additions & 35 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,19 @@
"@solana/spl-name-service": "^0.2.0",
"@solana/spl-token": "0.3.8",
"@solana/web3.js": "^1.87.3",
"@toruslabs/base-controllers": "^4.7.0",
"@toruslabs/base-controllers": "^4.11.0",
"@toruslabs/broadcast-channel": "^9.0.1",
"@toruslabs/eccrypto": "^4.0.0",
"@toruslabs/http-helpers": "^5.0.0",
"@toruslabs/http-helpers": "^6.0.0",
"@toruslabs/loglevel-sentry": "^6.0.1",
"@toruslabs/metadata-helpers": "^5.0.0",
"@toruslabs/openlogin": "^6.0.0",
"@toruslabs/openlogin-ed25519": "^6.0.0",
"@toruslabs/openlogin-jrpc": "^6.0.0",
"@toruslabs/openlogin-jrpc": "^6.1.0",
"@toruslabs/openlogin-session-manager": "^3.0.0",
"@toruslabs/openlogin-subkey": "^6.0.0",
"@toruslabs/openlogin-utils": "^6.0.0",
"@toruslabs/solana-controllers": "^4.7.0",
"@toruslabs/openlogin-utils": "^6.1.0",
"@toruslabs/solana-controllers": "^4.11.0",
"@toruslabs/tweetnacl-js": "^1.0.4",
"@toruslabs/vue-components": "^2.0.1",
"@toruslabs/vue-icons": "^2.0.0",
Expand Down
3 changes: 3 additions & 0 deletions src/controllers/TorusController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1651,6 +1651,9 @@ export default class TorusController extends BaseController<TorusControllerConfi
showWalletUi: () => {
throw new Error("Unsupported method");
},
showWindowBlockAlert: () => {
throw new Error("Unsupported method");
},
};
this.embedController.initializeProvider(commProviderHandlers);
}
Expand Down
4 changes: 2 additions & 2 deletions src/utils/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ import {
SolanaBlock,
SolanaCurrencyControllerConfig,
SolanaCurrencyControllerState,
SolanaNetworkState,
SolanaPreferencesConfig,
SolanaPreferencesState,
} from "@toruslabs/solana-controllers";
import { SolanaNetworkState } from "@toruslabs/solana-controllers/dist/types/Network/NetworkController";
import { TokenInfoState, TokensInfoConfig } from "@toruslabs/solana-controllers/dist/types/Tokens/TokenInfoController";
import { TokensTrackerConfig, TokensTrackerState } from "@toruslabs/solana-controllers/dist/types/Tokens/TokensTrackerController";
import type { TokensTrackerConfig, TokensTrackerState } from "@toruslabs/solana-controllers/dist/types/Tokens/TokensTrackerController";

export const LOCAL_STORAGE_KEY = "localStorage";
export const SESSION_STORAGE_KEY = "sessionStorage";
Expand Down
32 changes: 19 additions & 13 deletions tests/controller/nockRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default () => {
.query(true)
.reply(200, (_uri, _body) => {
// log.error(uri);
return JSON.stringify(mockData.coingekco["usd-coin"]);
return mockData.coingekco["usd-coin"];
});

const nockBackend = nock("https://solana-api.tor.us").persist();
Expand All @@ -52,28 +52,34 @@ export default () => {
.query(true)
.reply(200, (_uri) => {
log.error(_uri);
return JSON.stringify(mockData.backend.user);
return mockData.backend.user;
});

nockBackend.get("/currency?fsym=SOL&tsyms=USD").reply(200, () => JSON.stringify(mockData.backend.currency));
nockBackend.get("/currency?fsym=SOL&tsyms=USD").reply(200, () => mockData.backend.currency);

nockBackend.post("/auth/message").reply(200, () => JSON.stringify(mockData.backend.message));
nockBackend.post("/auth/message").reply(200, () => {
return mockData.backend.message;
});

nockBackend.post("/auth/verify").reply(200, () => JSON.stringify(mockData.backend.verify));
nockBackend.post("/auth/verify").reply(200, () => mockData.backend.verify);

nockBackend.post("/user").reply(200, (_uri, _requestbody) => JSON.stringify(mockData.backend.user));
nockBackend.post("/user").reply(200, (_uri, _requestbody) => mockData.backend.user);

nockBackend.post("/contact").reply(200, (_uri, _requestbody) => JSON.stringify({ data: _requestbody, message: "Contact Added", success: true }));
nockBackend.post("/contact").reply(200, (_uri, _requestbody) => {
return { data: _requestbody, message: "Contact Added", success: true };
});

nockBackend.post("/customtoken/fetchToken").reply(200, (_uri, _requestbody) => {
return { response: mockTokens.tokens, success: true };
});

nockBackend
.delete("/contact/46")
.reply(200, (_uri, _requestbody) => JSON.stringify({ data: { id: 46 }, message: "Contact Deleted", success: true }));
nockBackend.delete("/contact/46").reply(200, (_uri, _requestbody) => {
return { data: { id: 46 }, message: "Contact Deleted", success: true };
});

nockBackend.patch("/user").reply(201, (_uri, _requestbody) => JSON.stringify({ data: _requestbody, success: true }));
nockBackend.patch("/user").reply(201, (_uri, _requestbody) => {
return { data: _requestbody, success: true };
});

nockBackend.get("/billboard").reply(200, (_uri, _requestbody) => {
return { success: true, data: mockBillBoardEvent };
Expand Down Expand Up @@ -103,9 +109,9 @@ export default () => {
return { response: mockTokens.tokens, success: true };
});

nockBackend.post("/user/recordLogin").reply(200, () => JSON.stringify(mockData.backend.recordLogin));
nockBackend.post("/user/recordLogin").reply(200, () => mockData.backend.recordLogin);

nockBackend.post("/transaction").reply(200, () => JSON.stringify(mockData.backend.transaction));
nockBackend.post("/transaction").reply(200, () => mockData.backend.transaction);

// api.mainnet-beta nock
// nock("https://api.mainnet-beta.solana.com")
Expand Down

0 comments on commit 4540546

Please sign in to comment.