Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
TosinJs committed May 20, 2024
1 parent 7f0e611 commit e22d27c
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 13 deletions.
4 changes: 4 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
UNIVERSAL_APP_CLIP_BASE_URL=https://test.network.com
IOS_APP_CLIP_BASE_URL=https://test.apple.com/id?p=test
ANDROID_APP_CLIP_BASE_URL=https://test.android.com
WATSON_URL=https://test.com/public/gql
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = {
node: true,
jest: true,
},
ignorePatterns: ['.eslintrc.js', 'codegen.ts', 'jest.config.js', 'rollup.config.js', 'tests'],
ignorePatterns: ['.eslintrc.js', 'codegen.ts', 'jest.config.js', 'rollup.config.js', 'tests', 'examples'],
rules: {
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
Expand Down
6 changes: 3 additions & 3 deletions examples/example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ const redirectURL = "https://example.com"
const data: InputData = {
uber: {
traits: ["rating"],
activites: ["trip"],
activities: ["trip"],
},
netflix: {
traits: ["plan"],
activites: ["watch"]
activities: ["watch"]
},
instacart: {
activites: ["shop"]
activities: ["shop"]
}
}

Expand Down
3 changes: 2 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module.exports = {
'^.+\\.tsx?$': 'ts-jest'
},
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node']
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
setupFiles: ['<rootDir>/tests/setupEnv.ts'],
};

14 changes: 7 additions & 7 deletions src/tests/connect.spec.ts → tests/connect.spec.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { verifyPublicKey } from "../api/publicKey";
import { getSupportedServices } from "../api/supportedServices";
import Connect from "../index";
import { ANDROID_APP_CLIP_BASE_URL, IOS_APP_CLIP_BASE_URL, UNIVERSAL_APP_CLIP_BASE_URL } from "../lib/constants";
import { InputData, Platform } from "../types";
import { verifyPublicKey } from "../src/api/publicKey";
import { getSupportedServices } from "../src/api/supportedServices";
import Connect from "../src/index";
import { ANDROID_APP_CLIP_BASE_URL, IOS_APP_CLIP_BASE_URL, UNIVERSAL_APP_CLIP_BASE_URL } from "../src/lib/constants";
import { InputData, Platform } from "../src/types";

jest.mock("../api/publicKey", () => ({
jest.mock("../src/api/publicKey", () => ({
verifyPublicKey: jest.fn(),
}));

jest.mock("../api/supportedServices", () => ({
jest.mock("../src/api/supportedServices", () => ({
getSupportedServices: jest.fn(),
}));

Expand Down
3 changes: 3 additions & 0 deletions tests/setupEnv.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { config } from 'dotenv';

config({ path: '.env.test' });
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"allowJs": true,
"emitDeclarationOnly": false
},
"exclude": ["**/*.spec.ts", "**/*.test.ts", "tests", "examples"],
"exclude": ["tests", "examples"],
"include": ["src"]
}

0 comments on commit e22d27c

Please sign in to comment.