Skip to content

Commit

Permalink
refactor(permission-controller): Replace types in Caveat.test.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
rekmarks committed Apr 19, 2024
1 parent 6b95853 commit c2c596f
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions packages/permission-controller/src/Caveat.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { PermissionConstraint } from '.';
import type { Caveat, PermissionConstraint } from '.';
import { decorateWithCaveats, PermissionType } from '.';
import * as errors from './errors';

Expand All @@ -9,10 +9,11 @@ describe('decorateWithCaveats', () => {
const caveatSpecifications = {
reverse: {
type: 'reverse',
// eslint-disable-next-line @typescript-eslint/no-explicit-any
decorator: (method: any, _caveat: any) => async () => {
return (await method()).reverse();
},
decorator:
(method: () => Promise<unknown[]>, _caveat: Caveat<string, null>) =>
async () => {
return (await method()).reverse();
},
},
};

Expand Down Expand Up @@ -45,17 +46,19 @@ describe('decorateWithCaveats', () => {
const caveatSpecifications = {
reverse: {
type: 'reverse',
// eslint-disable-next-line @typescript-eslint/no-explicit-any
decorator: (method: any, _caveat: any) => async () => {
return (await method()).reverse();
},
decorator:
(method: () => Promise<unknown[]>, _caveat: Caveat<string, null>) =>
async () => {
return (await method()).reverse();
},
},
slice: {
type: 'slice',
// eslint-disable-next-line @typescript-eslint/no-explicit-any
decorator: (method: any, caveat: any) => async () => {
return (await method()).slice(0, caveat.value);
},
decorator:
(method: () => Promise<unknown[]>, caveat: Caveat<string, number>) =>
async () => {
return (await method()).slice(0, caveat.value);
},
},
};

Expand Down Expand Up @@ -111,10 +114,11 @@ describe('decorateWithCaveats', () => {
const caveatSpecifications = {
reverse: {
type: 'reverse',
// eslint-disable-next-line @typescript-eslint/no-explicit-any
decorator: (method: any, _caveat: any) => async () => {
return (await method()).reverse();
},
decorator:
(method: () => Promise<unknown[]>, _caveat: Caveat<string, null>) =>
async () => {
return (await method()).reverse();
},
},
};

Expand Down

0 comments on commit c2c596f

Please sign in to comment.