Skip to content

Commit

Permalink
feat: testing env on gh actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Siddharth9890 committed Nov 20, 2023
1 parent a893a7f commit 90cf3a3
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 23 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules/
.mesh/
.vscode/
.vscode/
.env
6 changes: 3 additions & 3 deletions .meshrc.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
sources:
- name: MyGraphQLApi
- name: GatewaySDK
handler:
graphql:
endpoint: https://develop.protocol.mygateway.xyz/v1/graphql
endpoint: '{env.GRAPHQL_ENDPOINT}'
transforms:
- filterSchema:
mode: bare
Expand All @@ -14,4 +14,4 @@ customFetch: ./custom-fetch.ts

sdk:
generateOperations:
selectionSetDepth: 2
selectionSetDepth: 2
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"devDependencies": {
"@types/jest": "^29.5.7",
"@typescript-eslint/eslint-plugin": "^6.4.0",
"dotenv": "^16.3.1",
"eslint": "^8.53.0",
"eslint-config-prettier": "^9.0.0",
"eslint-config-standard-with-typescript": "^39.1.1",
Expand Down
3 changes: 2 additions & 1 deletion pnpm-lock.yaml

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

28 changes: 10 additions & 18 deletions test/pda.test.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
import dotenv from 'dotenv';
import { Gateway } from '../src/Gateway';
import { PDAStatus, UserIdentifierType } from '../src/types';

dotenv.config();
const DEFAULT_TIMEOUT = 10000;

let api: Gateway;

beforeAll(() => {
console.log(process.env)
api = new Gateway({
apiKey: 'm9Y5ntNcTlwQ2LbRpYr6K_VhxJXuZJ6Q',
token:
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwcm90b2NvbF9pZCI6IjkwNzcwODA2LWFlMGMtNGExNS05MjYzLWU5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VnEvTFdwWjEzYmVzcS9QanpWXHJcbjR5ZnZaTkpyT3VxMXpkc29MdlVaUTVuMHJ1c21PekMyNlhMb3BpVlpUSWk3U1k4QzAvNFNlaVVvaU8vaVBFbnhcclxuOW5nL0RUMEsvQXlLbTBZQ1oxU2pwZ1VDQXdFQUFRPT1cclxuLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0tXHJcbiJ9LCJ0eXBlIjoiYXV0aF90b2tlbiIsImlhdCI6MTY5ODIxMTg0N30.zUxmPhnrQlIEZ5pMzHBMFkcqPvjsIfs0er9Dylw5olE',
apiKey: process.env.API_KEY!,
token: process.env.BEARER_TOKEN!,
});
});

describe('PDA TESTING', () => {
describe('PDA SERVICE TESTING', () => {
it(
'create pda',
'pda crud',
async () => {
let obj = {
dataModelId: 'f4014d53-b30f-4490-9812-cea379a1b398',
dataModelId: process.env.DATAMODEL_ID!,
description: 'test',
title: 'test',
claim: {
gatewayUse: 'test',
},
owner: {
type: UserIdentifierType.EMAIL,
type: UserIdentifierType.GATEWAY_ID,
value: 'sid',
},
};
Expand All @@ -35,16 +36,7 @@ describe('PDA TESTING', () => {
status: PDAStatus.Suspended,
});
expect(changePDAStatus.status).toEqual(PDAStatus.Suspended);
},
DEFAULT_TIMEOUT,
);

it(
'get single pda',
async () => {
const { PDA } = await api.pda.getPDA(
'6bc1a11f-f91d-4361-9a22-5df8d1bf4dc8',
);
const { PDA } = await api.pda.getPDA(createPDA.id);
expect(PDA?.dataAsset?.title).toEqual('test');
},
DEFAULT_TIMEOUT,
Expand Down

0 comments on commit 90cf3a3

Please sign in to comment.