mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-25 00:07:47 +01:00
add editable tests
This commit is contained in:
parent
a9b783443b
commit
b137cf0eaa
@ -123,3 +123,46 @@ test('validate format when updating strategy', t => {
|
||||
.send({})
|
||||
.expect(400);
|
||||
});
|
||||
|
||||
test('editable=false will stop delete request', t => {
|
||||
t.plan(0);
|
||||
const name = 'default';
|
||||
const { request, base } = getSetup();
|
||||
|
||||
return request.delete(`${base}/api/admin/strategies/${name}`).expect(500);
|
||||
});
|
||||
|
||||
test('editable=false will stop edit request', t => {
|
||||
t.plan(0);
|
||||
const name = 'default';
|
||||
const { request, base } = getSetup();
|
||||
|
||||
return request
|
||||
.put(`${base}/api/admin/strategies/${name}`)
|
||||
.send({ name, parameters: [] })
|
||||
.expect(500);
|
||||
});
|
||||
|
||||
test('editable=true will allow delete request', t => {
|
||||
t.plan(0);
|
||||
const name = 'deleteStrat';
|
||||
const { request, base, strategyStore } = getSetup();
|
||||
strategyStore.addStrategy({ name, parameters: [] });
|
||||
|
||||
return request
|
||||
.delete(`${base}/api/admin/strategies/${name}`)
|
||||
.send({})
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
test('editable=true will allow edit request', t => {
|
||||
t.plan(0);
|
||||
const name = 'editStrat';
|
||||
const { request, base, strategyStore } = getSetup();
|
||||
strategyStore.addStrategy({ name, parameters: [] });
|
||||
|
||||
return request
|
||||
.put(`${base}/api/admin/strategies/${name}`)
|
||||
.send({ name, parameters: [] })
|
||||
.expect(200);
|
||||
});
|
||||
|
2
test/fixtures/fake-strategies-store.js
vendored
2
test/fixtures/fake-strategies-store.js
vendored
@ -3,7 +3,7 @@
|
||||
const NotFoundError = require('../../lib/error/notfound-error');
|
||||
|
||||
module.exports = () => {
|
||||
const _strategies = [{ name: 'default', parameters: {} }];
|
||||
const _strategies = [{ name: 'default', editable: false, parameters: {} }];
|
||||
|
||||
return {
|
||||
getStrategies: () => Promise.resolve(_strategies),
|
||||
|
Loading…
Reference in New Issue
Block a user