@@ -214,7 +214,7 @@ describe('AzureUrlReader', () => {
|
||||
res(
|
||||
ctx.status(200),
|
||||
ctx.set('Content-Type', 'application/zip'),
|
||||
ctx.body(repoBuffer),
|
||||
ctx.body(new Uint8Array(repoBuffer)),
|
||||
),
|
||||
),
|
||||
rest.get(
|
||||
@@ -324,7 +324,7 @@ describe('AzureUrlReader', () => {
|
||||
res(
|
||||
ctx.status(200),
|
||||
ctx.set('Content-Type', 'application/zip'),
|
||||
ctx.body(repoBuffer),
|
||||
ctx.body(new Uint8Array(repoBuffer)),
|
||||
),
|
||||
),
|
||||
rest.get(
|
||||
|
||||
+2
-2
@@ -271,7 +271,7 @@ describe('BitbucketCloudUrlReader', () => {
|
||||
'content-disposition',
|
||||
'attachment; filename=backstage-mock-12ab34cd56ef.tar.gz',
|
||||
),
|
||||
ctx.body(repoBuffer),
|
||||
ctx.body(new Uint8Array(repoBuffer)),
|
||||
),
|
||||
),
|
||||
rest.get(
|
||||
@@ -399,7 +399,7 @@ describe('BitbucketCloudUrlReader', () => {
|
||||
'content-disposition',
|
||||
'attachment; filename=backstage-mock-12ab34cd56ef.tar.gz',
|
||||
),
|
||||
ctx.body(repoBuffer),
|
||||
ctx.body(new Uint8Array(repoBuffer)),
|
||||
),
|
||||
),
|
||||
rest.get(
|
||||
|
||||
+3
-3
@@ -71,7 +71,7 @@ describe('BitbucketServerUrlReader', () => {
|
||||
'content-disposition',
|
||||
'attachment; filename=backstage-mock.tgz',
|
||||
),
|
||||
ctx.body(repoBuffer),
|
||||
ctx.body(new Uint8Array(repoBuffer)),
|
||||
),
|
||||
),
|
||||
rest.get(
|
||||
@@ -157,7 +157,7 @@ describe('BitbucketServerUrlReader', () => {
|
||||
'content-disposition',
|
||||
'attachment; filename=backstage-mock.tgz',
|
||||
),
|
||||
ctx.body(repoBuffer),
|
||||
ctx.body(new Uint8Array(repoBuffer)),
|
||||
),
|
||||
),
|
||||
rest.get(
|
||||
@@ -216,7 +216,7 @@ describe('BitbucketServerUrlReader', () => {
|
||||
'content-disposition',
|
||||
'attachment; filename=backstage-mock.tgz',
|
||||
),
|
||||
ctx.body(repoBuffer),
|
||||
ctx.body(new Uint8Array(repoBuffer)),
|
||||
),
|
||||
),
|
||||
rest.get(
|
||||
|
||||
@@ -324,7 +324,7 @@ describe('BitbucketUrlReader', () => {
|
||||
'content-disposition',
|
||||
'attachment; filename=backstage-mock-12ab34cd56ef.tar.gz',
|
||||
),
|
||||
ctx.body(repoBuffer),
|
||||
ctx.body(new Uint8Array(repoBuffer)),
|
||||
),
|
||||
),
|
||||
rest.get(
|
||||
@@ -347,7 +347,7 @@ describe('BitbucketUrlReader', () => {
|
||||
'content-disposition',
|
||||
'attachment; filename=backstage-mock.tgz',
|
||||
),
|
||||
ctx.body(privateBitbucketRepoBuffer),
|
||||
ctx.body(new Uint8Array(privateBitbucketRepoBuffer)),
|
||||
),
|
||||
),
|
||||
rest.get(
|
||||
@@ -491,7 +491,7 @@ describe('BitbucketUrlReader', () => {
|
||||
'content-disposition',
|
||||
'attachment; filename=backstage-mock-12ab34cd56ef.tar.gz',
|
||||
),
|
||||
ctx.body(repoBuffer),
|
||||
ctx.body(new Uint8Array(repoBuffer)),
|
||||
),
|
||||
),
|
||||
rest.get(
|
||||
@@ -562,7 +562,7 @@ describe('BitbucketUrlReader', () => {
|
||||
'content-disposition',
|
||||
'attachment; filename=backstage-mock.tgz',
|
||||
),
|
||||
ctx.body(privateBitbucketRepoBuffer),
|
||||
ctx.body(new Uint8Array(privateBitbucketRepoBuffer)),
|
||||
),
|
||||
),
|
||||
rest.get(
|
||||
|
||||
@@ -291,7 +291,7 @@ describe.skip('GerritUrlReader', () => {
|
||||
'content-disposition',
|
||||
'attachment; filename=web-refs/heads/master.tar.gz',
|
||||
),
|
||||
ctx.body(repoArchiveBuffer),
|
||||
ctx.body(new Uint8Array(repoArchiveBuffer)),
|
||||
),
|
||||
),
|
||||
rest.get(
|
||||
@@ -304,7 +304,7 @@ describe.skip('GerritUrlReader', () => {
|
||||
'content-disposition',
|
||||
'attachment; filename=web-refs/heads/master-docs.tar.gz',
|
||||
),
|
||||
ctx.body(repoArchiveDocsBuffer),
|
||||
ctx.body(new Uint8Array(repoArchiveDocsBuffer)),
|
||||
),
|
||||
),
|
||||
rest.get(
|
||||
@@ -317,7 +317,7 @@ describe.skip('GerritUrlReader', () => {
|
||||
'content-disposition',
|
||||
'attachment; filename=web-refs/heads/master.tar.gz',
|
||||
),
|
||||
ctx.body(repoArchiveBuffer),
|
||||
ctx.body(new Uint8Array(repoArchiveBuffer)),
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -330,7 +330,10 @@ describe.skip('GerritUrlReader', () => {
|
||||
it('reads the wanted files correctly using gitiles.', async () => {
|
||||
worker.use(
|
||||
rest.get(branchAPIUrl, (_, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.body(branchAPIresponse));
|
||||
return res(
|
||||
ctx.status(200),
|
||||
ctx.body(new Uint8Array(branchAPIresponse)),
|
||||
);
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -353,7 +356,10 @@ describe.skip('GerritUrlReader', () => {
|
||||
it('throws NotModifiedError for matching etags.', async () => {
|
||||
worker.use(
|
||||
rest.get(branchAPIUrl, (_, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.body(branchAPIresponse));
|
||||
return res(
|
||||
ctx.status(200),
|
||||
ctx.body(new Uint8Array(branchAPIresponse)),
|
||||
);
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -389,7 +395,10 @@ describe.skip('GerritUrlReader', () => {
|
||||
it('should returns wanted files with a subpath using gitiles', async () => {
|
||||
worker.use(
|
||||
rest.get(branchAPIUrl, (_, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.body(branchAPIresponse));
|
||||
return res(
|
||||
ctx.status(200),
|
||||
ctx.body(new Uint8Array(branchAPIresponse)),
|
||||
);
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -462,7 +471,7 @@ describe.skip('GerritUrlReader', () => {
|
||||
ctx.status(200),
|
||||
ctx.set('Content-Type', 'application/json'),
|
||||
ctx.set('content-disposition', 'attachment'),
|
||||
ctx.body(treeRecursiveResponse),
|
||||
ctx.body(new Uint8Array(treeRecursiveResponse)),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -522,7 +531,10 @@ describe.skip('GerritUrlReader', () => {
|
||||
it('reads the wanted files correctly using gitiles.', async () => {
|
||||
worker.use(
|
||||
rest.get(branchAPIUrl, (_, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.body(branchAPIresponse));
|
||||
return res(
|
||||
ctx.status(200),
|
||||
ctx.body(new Uint8Array(branchAPIresponse)),
|
||||
);
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -549,7 +561,10 @@ describe.skip('GerritUrlReader', () => {
|
||||
it('throws NotModifiedError for matching etags.', async () => {
|
||||
worker.use(
|
||||
rest.get(branchAPIUrl, (_, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.body(branchAPIresponse));
|
||||
return res(
|
||||
ctx.status(200),
|
||||
ctx.body(new Uint8Array(branchAPIresponse)),
|
||||
);
|
||||
}),
|
||||
);
|
||||
|
||||
|
||||
@@ -279,7 +279,7 @@ describe('GiteaUrlReader', () => {
|
||||
'content-disposition',
|
||||
'attachment; filename=backstage-mock.tar.gz',
|
||||
),
|
||||
ctx.body(repoBuffer),
|
||||
ctx.body(new Uint8Array(repoBuffer)),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
@@ -373,7 +373,7 @@ describe('GithubUrlReader', () => {
|
||||
'content-disposition',
|
||||
'attachment; filename=backstage-mock-etag123.tar.gz',
|
||||
),
|
||||
ctx.body(repoBuffer),
|
||||
ctx.body(new Uint8Array(repoBuffer)),
|
||||
),
|
||||
),
|
||||
rest.get(
|
||||
@@ -390,7 +390,7 @@ describe('GithubUrlReader', () => {
|
||||
'content-disposition',
|
||||
'attachment; filename=backstage-mock-etag123.tar.gz',
|
||||
),
|
||||
ctx.body(repoBuffer),
|
||||
ctx.body(new Uint8Array(repoBuffer)),
|
||||
),
|
||||
),
|
||||
rest.get(
|
||||
@@ -480,7 +480,7 @@ describe('GithubUrlReader', () => {
|
||||
'content-disposition',
|
||||
'attachment; filename=backstage-mock-etag123.tar.gz',
|
||||
),
|
||||
ctx.body(repoBuffer),
|
||||
ctx.body(new Uint8Array(repoBuffer)),
|
||||
);
|
||||
},
|
||||
),
|
||||
@@ -531,7 +531,7 @@ describe('GithubUrlReader', () => {
|
||||
'content-disposition',
|
||||
'attachment; filename=backstage-mock-etag123.tar.gz',
|
||||
),
|
||||
ctx.body(repoBuffer),
|
||||
ctx.body(new Uint8Array(repoBuffer)),
|
||||
);
|
||||
},
|
||||
),
|
||||
@@ -720,7 +720,7 @@ describe('GithubUrlReader', () => {
|
||||
'content-disposition',
|
||||
'attachment; filename=backstage-mock-etag123.tar.gz',
|
||||
),
|
||||
ctx.body(repoBuffer),
|
||||
ctx.body(new Uint8Array(repoBuffer)),
|
||||
),
|
||||
),
|
||||
rest.get(
|
||||
@@ -733,7 +733,7 @@ describe('GithubUrlReader', () => {
|
||||
'content-disposition',
|
||||
'attachment; filename=backstage-mock-etag123.tar.gz',
|
||||
),
|
||||
ctx.body(repoBuffer),
|
||||
ctx.body(new Uint8Array(repoBuffer)),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -310,7 +310,7 @@ describe('GitlabUrlReader', () => {
|
||||
'content-disposition',
|
||||
'attachment; filename="mock-main-sha123abc.zip"',
|
||||
),
|
||||
ctx.body(archiveBuffer),
|
||||
ctx.body(new Uint8Array(archiveBuffer)),
|
||||
),
|
||||
),
|
||||
rest.get(
|
||||
@@ -388,7 +388,7 @@ describe('GitlabUrlReader', () => {
|
||||
'content-disposition',
|
||||
'attachment; filename="mock-main-sha123abc.zip"',
|
||||
),
|
||||
ctx.body(archiveBuffer),
|
||||
ctx.body(new Uint8Array(archiveBuffer)),
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -437,7 +437,7 @@ describe('GitlabUrlReader', () => {
|
||||
'content-disposition',
|
||||
'attachment; filename="mock-main-sha123abc.zip"',
|
||||
),
|
||||
ctx.body(archiveBuffer),
|
||||
ctx.body(new Uint8Array(archiveBuffer)),
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -632,7 +632,7 @@ describe('GitlabUrlReader', () => {
|
||||
'content-disposition',
|
||||
`attachment; filename="${filename}"`,
|
||||
),
|
||||
ctx.body(body),
|
||||
ctx.body(new Uint8Array(body)),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
@@ -215,7 +215,7 @@ describe('HarnessUrlReader', () => {
|
||||
'content-disposition',
|
||||
'attachment; filename=backstage-mock.zip',
|
||||
),
|
||||
ctx.body(repoBuffer),
|
||||
ctx.body(new Uint8Array(repoBuffer)),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ const resourceRef = createTranslationRef({
|
||||
bar: 'Bar',
|
||||
},
|
||||
translations: {
|
||||
sv: () => Promise.resolve({ default: { foo: 'Föö', bar: null } }),
|
||||
sv: () => Promise.resolve({ default: { foo: 'Föö' } as any }),
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -323,7 +323,7 @@ describe('Integration Test', () => {
|
||||
foo: 'Foo',
|
||||
},
|
||||
translations: {
|
||||
de: () => Promise.resolve({ default: { foo: 'Bar' } }),
|
||||
de: () => Promise.resolve({ default: { foo: 'Bar' } as any }),
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ describe('GerritEntityProvider', () => {
|
||||
res(
|
||||
ctx.status(200),
|
||||
ctx.set('Content-Type', 'application/json'),
|
||||
ctx.body(repoBuffer),
|
||||
ctx.body(new Uint8Array(repoBuffer)),
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -157,7 +157,7 @@ describe('GerritEntityProvider', () => {
|
||||
res(
|
||||
ctx.status(200),
|
||||
ctx.set('Content-Type', 'application/json'),
|
||||
ctx.body(repoBuffer),
|
||||
ctx.body(new Uint8Array(repoBuffer)),
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -192,7 +192,7 @@ describe('GerritEntityProvider', () => {
|
||||
res(
|
||||
ctx.status(200),
|
||||
ctx.set('Content-Type', 'application/json'),
|
||||
ctx.body(repoBuffer),
|
||||
ctx.body(new Uint8Array(repoBuffer)),
|
||||
),
|
||||
),
|
||||
rest.get('https://g.com/gerrit/projects/:project/HEAD', (_, res, ctx) =>
|
||||
@@ -400,7 +400,7 @@ describe('GerritEntityProvider', () => {
|
||||
res(
|
||||
ctx.status(200),
|
||||
ctx.set('Content-Type', 'application/json'),
|
||||
ctx.body(repoBuffer),
|
||||
ctx.body(new Uint8Array(repoBuffer)),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -292,7 +292,7 @@ describe('PermissionIntegrationClient', () => {
|
||||
createPermissionRule({
|
||||
name: 'RULE_1',
|
||||
description: 'Test rule 1',
|
||||
resourceType: 'test-resource',
|
||||
resourceType: 'test-resource' as const,
|
||||
paramsSchema: z.object({
|
||||
input: z.enum(['yes', 'no']),
|
||||
}),
|
||||
@@ -304,7 +304,7 @@ describe('PermissionIntegrationClient', () => {
|
||||
createPermissionRule({
|
||||
name: 'RULE_2',
|
||||
description: 'Test rule 2',
|
||||
resourceType: 'test-resource',
|
||||
resourceType: 'test-resource' as const,
|
||||
|
||||
paramsSchema: z.object({
|
||||
input: z.enum(['yes', 'no']),
|
||||
|
||||
@@ -21,11 +21,14 @@ import {
|
||||
import { z } from 'zod';
|
||||
import { createConditionExports } from './createConditionExports';
|
||||
import { createPermissionRule } from './createPermissionRule';
|
||||
import { createPermissionResourceRef } from './createPermissionResourceRef';
|
||||
|
||||
const testIntegration = () =>
|
||||
createConditionExports({
|
||||
pluginId: 'test-plugin',
|
||||
resourceType: 'test-resource',
|
||||
resourceRef: createPermissionResourceRef<any, any>().with({
|
||||
pluginId: 'test-plugin',
|
||||
resourceType: 'test-resource',
|
||||
}),
|
||||
rules: {
|
||||
testRule1: createPermissionRule({
|
||||
name: 'testRule1',
|
||||
|
||||
@@ -32,7 +32,7 @@ import { renderHook } from '@testing-library/react';
|
||||
import { PropsWithChildren } from 'react';
|
||||
import { formDecoratorsApiRef } from '../../api';
|
||||
|
||||
window.TextEncoder = TextEncoder;
|
||||
window.TextEncoder = TextEncoder as any;
|
||||
|
||||
describe('base64EncodeContent', () => {
|
||||
it('encodes text files', () => {
|
||||
|
||||
Reference in New Issue
Block a user