Skip to content

Commit 329fb95

Browse files
committed
fix tests, async call
1 parent f1b87b6 commit 329fb95

1 file changed

Lines changed: 21 additions & 21 deletions

File tree

src/test/unit/credentials.test.ts

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,26 @@ describe('credentials', () => {
2929
envOverrides = await setupEnvironment(null, envOverrides)
3030
})
3131

32-
it('should deny access with undefined or empty credentials', () => {
32+
it('should deny access with undefined or empty credentials', async () => {
3333
const credentialsUndefined: Credentials = undefined
3434
const consumerAddress = '0x123'
35-
const accessGranted1 = checkCredentials(credentialsUndefined, consumerAddress)
35+
const accessGranted1 = await checkCredentials(credentialsUndefined, consumerAddress)
3636
expect(accessGranted1).to.equal(false)
3737
const credentialsEmapty = {} as Credentials
38-
const accessGranted2 = checkCredentials(credentialsEmapty, consumerAddress)
38+
const accessGranted2 = await checkCredentials(credentialsEmapty, consumerAddress)
3939
expect(accessGranted2).to.equal(false)
4040
})
41-
it('should deny access with empty allow and deny lists', () => {
41+
it('should deny access with empty allow and deny lists', async () => {
4242
// if list does not exist or is empty access is denied
4343
const credentials: Credentials = {
4444
allow: [],
4545
deny: []
4646
}
4747
const consumerAddress = '0x123'
48-
const accessGranted = checkCredentials(credentials, consumerAddress)
48+
const accessGranted = await checkCredentials(credentials, consumerAddress)
4949
expect(accessGranted).to.equal(false)
5050
})
51-
it('should deny access with empty values in deny lists', () => {
51+
it('should deny access with empty values in deny lists', async () => {
5252
const credentials: Credentials = {
5353
deny: [
5454
{
@@ -58,11 +58,11 @@ describe('credentials', () => {
5858
]
5959
}
6060
const consumerAddress = '0x123'
61-
const accessGranted = checkCredentials(credentials, consumerAddress)
61+
const accessGranted = await checkCredentials(credentials, consumerAddress)
6262
expect(accessGranted).to.equal(false)
6363
})
6464

65-
it('should deny access with "accessList" credentials (default behaviour if cannot check)', () => {
65+
it('should deny access with "accessList" credentials (default behaviour if cannot check)', async () => {
6666
const consumerAddress = '0x123'
6767
const credentials: Credentials = {
6868
deny: [
@@ -73,11 +73,11 @@ describe('credentials', () => {
7373
]
7474
}
7575

76-
const accessGranted = checkCredentials(credentials, consumerAddress)
76+
const accessGranted = await checkCredentials(credentials, consumerAddress)
7777
expect(accessGranted).to.equal(false)
7878
})
7979

80-
it('should deny access with empty values in allow lists', () => {
80+
it('should deny access with empty values in allow lists', async () => {
8181
const credentials: Credentials = {
8282
allow: [
8383
{
@@ -87,10 +87,10 @@ describe('credentials', () => {
8787
]
8888
}
8989
const consumerAddress = '0x123'
90-
const accessGranted = checkCredentials(credentials, consumerAddress)
90+
const accessGranted = await checkCredentials(credentials, consumerAddress)
9191
expect(accessGranted).to.equal(false)
9292
})
93-
it('should allow access with address in allow list', () => {
93+
it('should allow access with address in allow list', async () => {
9494
const credentials: Credentials = {
9595
allow: [
9696
{
@@ -100,10 +100,10 @@ describe('credentials', () => {
100100
]
101101
}
102102
const consumerAddress = '0x123'
103-
const accessGranted = checkCredentials(credentials, consumerAddress)
103+
const accessGranted = await checkCredentials(credentials, consumerAddress)
104104
expect(accessGranted).to.equal(true)
105105
})
106-
it('should deny access with address not explicitly in deny list but also without any allow list', () => {
106+
it('should deny access with address not explicitly in deny list but also without any allow list', async () => {
107107
const credentials: Credentials = {
108108
deny: [
109109
{
@@ -113,10 +113,10 @@ describe('credentials', () => {
113113
]
114114
}
115115
const consumerAddress = '0x123'
116-
const accessGranted = checkCredentials(credentials, consumerAddress)
116+
const accessGranted = await checkCredentials(credentials, consumerAddress)
117117
expect(accessGranted).to.equal(false) // its not denied explicitly but not allowed either
118118
})
119-
it('should deny access with address in deny list', () => {
119+
it('should deny access with address in deny list', async () => {
120120
const credentials: Credentials = {
121121
allow: [
122122
{
@@ -132,10 +132,10 @@ describe('credentials', () => {
132132
]
133133
}
134134
const consumerAddress = '0x123'
135-
const accessGranted = checkCredentials(credentials, consumerAddress)
135+
const accessGranted = await checkCredentials(credentials, consumerAddress)
136136
expect(accessGranted).to.equal(false)
137137
})
138-
it('should deny access with address not in allow list', () => {
138+
it('should deny access with address not in allow list', async () => {
139139
const credentials: Credentials = {
140140
allow: [
141141
{
@@ -151,7 +151,7 @@ describe('credentials', () => {
151151
]
152152
}
153153
const consumerAddress = '0x123'
154-
const accessGranted = checkCredentials(credentials, consumerAddress)
154+
const accessGranted = await checkCredentials(credentials, consumerAddress)
155155
expect(accessGranted).to.equal(false)
156156
})
157157

@@ -229,7 +229,7 @@ describe('credentials', () => {
229229
expect(hasAddressMatchAllRule(creds2.credentials.allow)).to.be.equal(false)
230230
})
231231

232-
it('should deny access by default if no specific allow rule is a match', () => {
232+
it('should deny access by default if no specific allow rule is a match', async () => {
233233
const credentials: Credentials = {
234234
allow: [
235235
{
@@ -245,7 +245,7 @@ describe('credentials', () => {
245245
]
246246
}
247247
const consumerAddress = '0x123'
248-
const accessGranted = checkCredentials(
248+
const accessGranted = await checkCredentials(
249249
credentials,
250250
consumerAddress,
251251
DEVELOPMENT_CHAIN_ID

0 commit comments

Comments
 (0)