Skip to content

Commit 0da65b3

Browse files
committed
fix: update config.set tests to use valid config keys
- replace arbitrary 'Fruit' key with 'Gateway.RootRedirect' - replace removed 'Discovery.MDNS.Interval' with 'Gateway.MaxConcurrentRequests' - add test for unknown config key rejection - kubo no longer allows arbitrary config keys
1 parent b1dd61d commit 0da65b3

File tree

1 file changed

+13
-8
lines changed
  • test/interface-tests/src/config

1 file changed

+13
-8
lines changed

test/interface-tests/src/config/set.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,21 @@ export function testSet (factory: Factory<KuboNode>, options: MochaConfig): void
2323
})
2424

2525
it('should set a new key', async () => {
26-
await ipfs.config.set('Fruit', 'banana')
26+
await ipfs.config.set('Gateway.RootRedirect', '/test1')
2727

28-
const fruit = await ipfs.config.get('Fruit')
29-
expect(fruit).to.equal('banana')
28+
const redirect = await ipfs.config.get('Gateway.RootRedirect')
29+
expect(redirect).to.equal('/test1')
3030
})
3131

3232
it('should set an already existing key', async () => {
33-
await ipfs.config.set('Fruit', 'morango')
33+
await ipfs.config.set('Gateway.RootRedirect', '/test2')
3434

35-
const fruit = await ipfs.config.get('Fruit')
36-
expect(fruit).to.equal('morango')
35+
const redirect = await ipfs.config.get('Gateway.RootRedirect')
36+
expect(redirect).to.equal('/test2')
3737
})
3838

3939
it('should set a number', async () => {
40-
const key = 'Discovery.MDNS.Interval'
40+
const key = 'Gateway.MaxConcurrentRequests'
4141
const val = 11
4242

4343
await ipfs.config.set(key, val)
@@ -77,10 +77,15 @@ export function testSet (factory: Factory<KuboNode>, options: MochaConfig): void
7777
return expect(ipfs.config.set(uint8ArrayFromString('heeey'), '')).to.eventually.be.rejected()
7878
})
7979

80+
it('should fail on unknown config key', () => {
81+
return expect(ipfs.config.set('Fruit', 'banana')).to.eventually.be.rejected()
82+
.with.property('message').that.matches(/Fruit not found/)
83+
})
84+
8085
it('should fail on non valid value', () => {
8186
const val: any = {}
8287
val.val = val
83-
return expect(ipfs.config.set('Fruit', val)).to.eventually.be.rejected()
88+
return expect(ipfs.config.set('Gateway.RootRedirect', val)).to.eventually.be.rejected()
8489
})
8590
})
8691
}

0 commit comments

Comments
 (0)