Skip to content

Commit

Permalink
Merge pull request #282 from snyk-tech-services/fix/migrateOrgEndpoint
Browse files Browse the repository at this point in the history
fix: change org creation endpoint
  • Loading branch information
mathild3r authored Feb 11, 2022
2 parents 57b9d22 + d758fdb commit 616d43b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
7 changes: 5 additions & 2 deletions src/lib/api/group/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,16 @@ export async function createOrg(
}
const body: {
name: string;
groupId: string;
sourceOrgId?: string;
} = {
name,
groupId,
sourceOrgId,
};
const res = await requestManager.request({
verb: 'post',
url: `/group/${groupId}/org`,
url: `/org`,
body: JSON.stringify(body),
});
const statusCode = res.statusCode || res.status;
Expand Down Expand Up @@ -80,7 +82,8 @@ export async function listOrgs(
const statusCode = res.statusCode || res.status;
if (!statusCode || statusCode !== 200) {
throw new Error(
'Expected a 200 response, instead received: ' + JSON.stringify({statusCode, data: res.data}),
'Expected a 200 response, instead received: ' +
JSON.stringify({ statusCode, data: res.data }),
);
}

Expand Down
8 changes: 4 additions & 4 deletions test/scripts/import-projects.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('Import projects script', () => {
await deleteTestProjects(ORG_ID, discoveredProjects);
await deleteFiles(logs);
process.env = { ...OLD_ENV };
}, 5000);
}, 10000);

it('succeeds to import targets from file', async () => {
const logFiles = generateLogsPaths(__dirname, ORG_ID);
Expand Down Expand Up @@ -88,7 +88,7 @@ describe('Skips & logs issues', () => {
afterEach(async () => {
await deleteFiles(logs);
process.env = { ...OLD_ENV };
}, 1000);
}, 10000);

afterAll(async () => {
await deleteTestProjects(ORG_ID, discoveredProjects);
Expand Down Expand Up @@ -204,7 +204,7 @@ describe('Error handling', () => {

afterAll(async () => {
process.env = { ...OLD_ENV };
}, 1000);
}, 10000);

it('shows correct error when input can not be loaded', async () => {
expect(
Expand Down Expand Up @@ -247,7 +247,7 @@ describe('No projects scenarios', () => {
await deleteTestProjects(ORG_ID, discoveredProjects);
await deleteFiles(logs);
process.env = { ...OLD_ENV };
});
}, 10000);
it('succeeds to complete import targets from empty repo', async () => {
const testName = 'empty-target';
const logPath = path.resolve(__dirname + '/fixtures/' + testName);
Expand Down

0 comments on commit 616d43b

Please sign in to comment.