Skip to content

Commit

Permalink
chore: keep hasAccess fully internal
Browse files Browse the repository at this point in the history
  • Loading branch information
HendrikThePendric committed Oct 16, 2023
1 parent 69e9e5f commit 7df5ed5
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
hasAuthority,
getInterpretationAccess,
getCommentAccess,
} from '../getInterpretationAccess.js'
Expand Down Expand Up @@ -35,18 +34,6 @@ const userJane = {
}

describe('interpretation and comment access', () => {
describe('hasAuthority', () => {
it('throws an error when no authority is provided', () => {
expect(() => hasAuthority([], undefined)).toThrow(
'"hasAuthority" requires "authority" to be a populated string but received undefined'
)
})
it('throws an error when authority is not a string', () => {
expect(() => hasAuthority([], 12)).toThrow(
'"hasAuthority" requires "authority" to be a populated string but received 12'
)
})
})
describe('getInterpretationAccess', () => {
it('returns true for all accesses for superuser', () => {
const interpretation = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// For backwards compatibility
// accept both Set (from the old d2.currentUser object) and array
export const hasAuthority = (authorities, authority) => {
const hasAuthority = (authorities, authority) => {
if (!authority || typeof authority !== 'string') {
throw new Error(
`"hasAuthority" requires "authority" to be a populated string but received ${authority}`
Expand Down

0 comments on commit 7df5ed5

Please sign in to comment.