Skip to content

Commit e3efdd0

Browse files
author
Adam Spiers
committed
fix(sds): fix type errors
1 parent b95362d commit e3efdd0

File tree

3 files changed

+31
-8
lines changed

3 files changed

+31
-8
lines changed

packages/sds/tests/organization-creation.test.ts

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,25 @@
11
import { TestNetwork } from '@atproto/dev-env'
2-
import { SdsAppContext } from '../src/sds-context'
2+
3+
interface MockSdsContext {
4+
authVerifier: {
5+
authorization: () => {
6+
auth: { credentials: { did: string } }
7+
}
8+
}
9+
accountManager: {
10+
createAccount: jest.Mock
11+
}
12+
sharedRepoManager: {
13+
grantAccess: jest.Mock
14+
}
15+
idResolver: {
16+
resolveIdentity: jest.Mock
17+
}
18+
}
319

420
describe('organization creation', () => {
521
let network: TestNetwork
6-
let ctx: SdsAppContext
22+
let ctx: MockSdsContext
723

824
beforeAll(async () => {
925
network = await TestNetwork.create({
@@ -34,7 +50,7 @@ describe('organization creation', () => {
3450
handle: 'test-org.sds.local',
3551
}),
3652
},
37-
} as any
53+
}
3854
})
3955

4056
afterAll(async () => {

packages/sds/tests/sds-auth-integration.test.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,11 @@ describe('SDS Auth Integration', () => {
222222

223223
test('should handle admin permission inheritance', async () => {
224224
// Grant admin permissions
225-
const permissions: RepositoryPermissions = { admin: true }
225+
const permissions: RepositoryPermissions = {
226+
read: true,
227+
write: true,
228+
admin: true,
229+
}
226230
await permissionManager.grantAccess(
227231
testRepoDid,
228232
testUserDid,
@@ -254,7 +258,10 @@ describe('SDS Auth Integration', () => {
254258

255259
test('should handle write permission inheritance', async () => {
256260
// Grant write permissions
257-
const permissions: RepositoryPermissions = { write: true }
261+
const permissions: RepositoryPermissions = {
262+
read: true,
263+
write: true,
264+
}
258265
await permissionManager.grantAccess(
259266
testRepoDid,
260267
testUserDid,

packages/sds/tests/sds-endpoints-unit.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ describe('SDS Endpoints Unit Tests', () => {
374374
})
375375

376376
test('should validate permission object structure', async () => {
377-
const invalidPermissions = [
377+
const invalidPermissions: unknown[] = [
378378
{ read: 'true', write: 'false' }, // String instead of boolean
379379
{ read: 1, write: 0 }, // Number instead of boolean
380380
{ read: null, write: undefined }, // Null/undefined instead of boolean
@@ -386,7 +386,7 @@ describe('SDS Endpoints Unit Tests', () => {
386386
await permissionManager.grantAccess(
387387
testRepoDid,
388388
testUserDid,
389-
_invalidPermissions,
389+
_invalidPermissions as RepositoryPermissions,
390390
testOwnerDid,
391391
)
392392

@@ -403,7 +403,7 @@ describe('SDS Endpoints Unit Tests', () => {
403403
write: true,
404404
admin: true,
405405
malicious: '"; DROP TABLE shared_repository_permissions; --',
406-
} as any
406+
} as unknown as RepositoryPermissions
407407

408408
try {
409409
await permissionManager.grantAccess(

0 commit comments

Comments
 (0)