-
-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'api-client/integration' of https://github.com/vr-varad/…
…keyshade into api-client/integration
- Loading branch information
Showing
9 changed files
with
110 additions
and
52 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import { APIClient } from '../src/core/client' | ||
import EnvironmentController from '../src/controllers/environment/environment' | ||
import EnvironmentController from '../src/controllers/environment' | ||
|
||
describe('Get Environments Tests', () => { | ||
describe('Environments Controller Tests', () => { | ||
const backendUrl = process.env.BACKEND_URL | ||
|
||
const client = new APIClient(backendUrl) | ||
|
@@ -10,7 +10,7 @@ describe('Get Environments Tests', () => { | |
const email = '[email protected]' | ||
let projectId: string | null | ||
let workspaceId: string | null | ||
let environment: any | ||
let environmentId: string | null | ||
|
||
beforeAll(async () => { | ||
//Create the user's workspace | ||
|
@@ -66,12 +66,12 @@ describe('Get Environments Tests', () => { | |
) | ||
).json()) as any | ||
|
||
environment = createEnvironmentResponse | ||
environmentId = createEnvironmentResponse.id | ||
}) | ||
|
||
afterEach(async () => { | ||
// Delete the environment | ||
await client.delete(`/api/environment/${environment.id}`, { | ||
await client.delete(`/api/environment/${environmentId}`, { | ||
'x-e2e-user-email': email | ||
}) | ||
}) | ||
|
@@ -112,15 +112,15 @@ describe('Get Environments Tests', () => { | |
const environmentResponse = ( | ||
await environmentController.getEnvironmentById( | ||
{ | ||
id: environment.id | ||
id: environmentId | ||
}, | ||
{ | ||
'x-e2e-user-email': email | ||
} | ||
) | ||
).data | ||
|
||
expect(environmentResponse.id).toBe(environment.id) | ||
expect(environmentResponse.id).toBe(environmentId) | ||
expect(environmentResponse.name).toBe('Dev') | ||
}) | ||
|
||
|
@@ -157,7 +157,7 @@ describe('Get Environments Tests', () => { | |
const updateEnvironmentResponse = ( | ||
await environmentController.updateEnvironment( | ||
{ | ||
id: environment.id, | ||
id: environmentId, | ||
name: 'Prod' | ||
}, | ||
{ | ||
|
@@ -169,7 +169,7 @@ describe('Get Environments Tests', () => { | |
expect(updateEnvironmentResponse.name).toBe('Prod') | ||
|
||
const fetchEnvironmentResponse = (await ( | ||
await client.get(`/api/environment/${environment.id}`, { | ||
await client.get(`/api/environment/${environmentId}`, { | ||
'x-e2e-user-email': email | ||
}) | ||
).json()) as any | ||
|
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { APIClient } from '../src/core/client' | ||
import EventController from '../src/controllers/event/event' | ||
import EventController from '../src/controllers/event' | ||
export enum EventSource { | ||
SECRET = 'SECRET', | ||
VARIABLE = 'VARIABLE', | ||
|
@@ -10,16 +10,14 @@ export enum EventSource { | |
INTEGRATION = 'INTEGRATION' | ||
} | ||
|
||
describe('Get Event Controller', () => { | ||
describe('Event Controller Tests', () => { | ||
const backendUrl = process.env.BACKEND_URL | ||
|
||
const client = new APIClient(backendUrl) | ||
const eventController = new EventController(backendUrl) | ||
const email = '[email protected]' | ||
let projectId: string | null | ||
let workspaceId: string | null | ||
let secret: any | ||
let variable: any | ||
let environment: any | ||
|
||
beforeAll(async () => { | ||
|
@@ -35,7 +33,6 @@ describe('Get Event Controller', () => { | |
} | ||
) | ||
).json()) as any | ||
console.log(workspaceResponse) | ||
workspaceId = workspaceResponse.id | ||
}) | ||
|
||
|
@@ -65,7 +62,6 @@ describe('Get Event Controller', () => { | |
{ workspaceId, source: 'PROJECT' }, | ||
{ 'x-e2e-user-email': email } | ||
) | ||
console.log(events.data.items) | ||
expect(events.data.items[0].source).toBe(EventSource.PROJECT) | ||
expect(events.data.items[0].metadata.projectId).toBe(projectId) | ||
expect(events.data.items[0].metadata.name).toBe('Project') | ||
|
@@ -122,7 +118,6 @@ describe('Get Event Controller', () => { | |
expect(events.data.items[0].source).toBe('SECRET') | ||
expect(events.data.items[0].metadata.secretId).toBe(secretRepsonse.id) | ||
expect(events.data.items[0].metadata.name).toBe('My secret') | ||
secret = secretRepsonse | ||
}) | ||
|
||
it('should fetch a Variable Event', async () => { | ||
|
@@ -151,6 +146,5 @@ describe('Get Event Controller', () => { | |
expect(events.data.items[0].source).toBe('VARIABLE') | ||
expect(events.data.items[0].metadata.variableId).toBe(variableResponse.id) | ||
expect(events.data.items[0].metadata.name).toBe('My variable') | ||
variable = variableResponse | ||
}) | ||
}) |
Oops, something went wrong.