mirror of
https://github.com/Unleash/unleash.git
synced 2025-09-05 17:53:12 +02:00
fix: make test run successfull again
This commit is contained in:
parent
150b74cca8
commit
41b7c336e4
@ -3,6 +3,7 @@ import getLogger from '../../fixtures/no-logger';
|
|||||||
import { ApiTokenService } from '../../../lib/services/api-token-service';
|
import { ApiTokenService } from '../../../lib/services/api-token-service';
|
||||||
import { createTestConfig } from '../../config/test-config';
|
import { createTestConfig } from '../../config/test-config';
|
||||||
import { ApiTokenType, IApiToken } from '../../../lib/types/models/api-token';
|
import { ApiTokenType, IApiToken } from '../../../lib/types/models/api-token';
|
||||||
|
import { DEFAULT_ENV } from '../../../lib/util/constants';
|
||||||
|
|
||||||
let db;
|
let db;
|
||||||
let stores;
|
let stores;
|
||||||
@ -43,7 +44,7 @@ test('should create client token', async () => {
|
|||||||
username: 'default-client',
|
username: 'default-client',
|
||||||
type: ApiTokenType.CLIENT,
|
type: ApiTokenType.CLIENT,
|
||||||
project: '*',
|
project: '*',
|
||||||
environment: '*',
|
environment: DEFAULT_ENV,
|
||||||
});
|
});
|
||||||
const allTokens = await apiTokenService.getAllTokens();
|
const allTokens = await apiTokenService.getAllTokens();
|
||||||
|
|
||||||
@ -73,7 +74,7 @@ test('should set expiry of token', async () => {
|
|||||||
type: ApiTokenType.CLIENT,
|
type: ApiTokenType.CLIENT,
|
||||||
expiresAt: time,
|
expiresAt: time,
|
||||||
project: '*',
|
project: '*',
|
||||||
environment: '*',
|
environment: DEFAULT_ENV,
|
||||||
});
|
});
|
||||||
|
|
||||||
const [token] = await apiTokenService.getAllTokens();
|
const [token] = await apiTokenService.getAllTokens();
|
||||||
@ -90,7 +91,7 @@ test('should update expiry of token', async () => {
|
|||||||
type: ApiTokenType.CLIENT,
|
type: ApiTokenType.CLIENT,
|
||||||
expiresAt: time,
|
expiresAt: time,
|
||||||
project: '*',
|
project: '*',
|
||||||
environment: '*',
|
environment: DEFAULT_ENV,
|
||||||
});
|
});
|
||||||
|
|
||||||
await apiTokenService.updateExpiry(token.secret, newTime);
|
await apiTokenService.updateExpiry(token.secret, newTime);
|
||||||
@ -109,7 +110,7 @@ test('should only return valid tokens', async () => {
|
|||||||
type: ApiTokenType.CLIENT,
|
type: ApiTokenType.CLIENT,
|
||||||
expiresAt: new Date('2021-01-01'),
|
expiresAt: new Date('2021-01-01'),
|
||||||
project: '*',
|
project: '*',
|
||||||
environment: '*',
|
environment: DEFAULT_ENV,
|
||||||
});
|
});
|
||||||
|
|
||||||
const activeToken = await apiTokenService.createApiToken({
|
const activeToken = await apiTokenService.createApiToken({
|
||||||
@ -117,7 +118,7 @@ test('should only return valid tokens', async () => {
|
|||||||
type: ApiTokenType.CLIENT,
|
type: ApiTokenType.CLIENT,
|
||||||
expiresAt: tomorrow,
|
expiresAt: tomorrow,
|
||||||
project: '*',
|
project: '*',
|
||||||
environment: '*',
|
environment: DEFAULT_ENV,
|
||||||
});
|
});
|
||||||
|
|
||||||
const tokens = await apiTokenService.getAllActiveTokens();
|
const tokens = await apiTokenService.getAllActiveTokens();
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
exported412-enterprise.json{
|
{
|
||||||
"version": 2,
|
"version": 2,
|
||||||
"features": [
|
"features": [
|
||||||
{
|
{
|
||||||
@ -145,7 +145,7 @@ exported412-enterprise.json{
|
|||||||
"id": "2ea91298-4565-4db2-8a23-50757001a076",
|
"id": "2ea91298-4565-4db2-8a23-50757001a076",
|
||||||
"featureName": "this-is-fun",
|
"featureName": "this-is-fun",
|
||||||
"projectName": "default",
|
"projectName": "default",
|
||||||
"environment": "default",
|
"environment": ":global:",
|
||||||
"strategyName": "gradualRolloutRandom",
|
"strategyName": "gradualRolloutRandom",
|
||||||
"parameters": {
|
"parameters": {
|
||||||
"percentage": "100"
|
"percentage": "100"
|
||||||
@ -157,7 +157,7 @@ exported412-enterprise.json{
|
|||||||
"id": "edaffaee-cf6e-473f-b137-ae15fb88ff53",
|
"id": "edaffaee-cf6e-473f-b137-ae15fb88ff53",
|
||||||
"featureName": "version.three.seventeen",
|
"featureName": "version.three.seventeen",
|
||||||
"projectName": "default",
|
"projectName": "default",
|
||||||
"environment": "default",
|
"environment": ":global:",
|
||||||
"strategyName": "default",
|
"strategyName": "default",
|
||||||
"parameters": {},
|
"parameters": {},
|
||||||
"constraints": [],
|
"constraints": [],
|
||||||
@ -167,7 +167,7 @@ exported412-enterprise.json{
|
|||||||
"id": "e6eaede4-027a-41a9-8e80-0e0fc0a5d7af",
|
"id": "e6eaede4-027a-41a9-8e80-0e0fc0a5d7af",
|
||||||
"featureName": "in-another-project",
|
"featureName": "in-another-project",
|
||||||
"projectName": "someother",
|
"projectName": "someother",
|
||||||
"environment": "default",
|
"environment": ":global:",
|
||||||
"strategyName": "gradualRolloutRandom",
|
"strategyName": "gradualRolloutRandom",
|
||||||
"parameters": {
|
"parameters": {
|
||||||
"percentage": "29"
|
"percentage": "29"
|
||||||
@ -194,7 +194,7 @@ exported412-enterprise.json{
|
|||||||
"id": "da60e934-246c-4b3e-b314-f2fd1828dd51",
|
"id": "da60e934-246c-4b3e-b314-f2fd1828dd51",
|
||||||
"featureName": "with-constraints",
|
"featureName": "with-constraints",
|
||||||
"projectName": "default",
|
"projectName": "default",
|
||||||
"environment": "default",
|
"environment": ":global:",
|
||||||
"strategyName": "default",
|
"strategyName": "default",
|
||||||
"parameters": {},
|
"parameters": {},
|
||||||
"constraints": [
|
"constraints": [
|
||||||
@ -212,7 +212,7 @@ exported412-enterprise.json{
|
|||||||
"id": "162058f5-3600-4299-97df-d543a0301bdd",
|
"id": "162058f5-3600-4299-97df-d543a0301bdd",
|
||||||
"featureName": "another-toggle",
|
"featureName": "another-toggle",
|
||||||
"projectName": "someother",
|
"projectName": "someother",
|
||||||
"environment": "default",
|
"environment": ":global:",
|
||||||
"strategyName": "userWithId",
|
"strategyName": "userWithId",
|
||||||
"parameters": {
|
"parameters": {
|
||||||
"userIds": "12541,123"
|
"userIds": "12541,123"
|
||||||
@ -224,7 +224,7 @@ exported412-enterprise.json{
|
|||||||
"id": "5630e0fb-ebc1-4313-b6df-06b0a563c7b4",
|
"id": "5630e0fb-ebc1-4313-b6df-06b0a563c7b4",
|
||||||
"featureName": "toggle-created-in-4-1",
|
"featureName": "toggle-created-in-4-1",
|
||||||
"projectName": "default",
|
"projectName": "default",
|
||||||
"environment": "default",
|
"environment": ":global:",
|
||||||
"strategyName": "applicationHostname",
|
"strategyName": "applicationHostname",
|
||||||
"parameters": {
|
"parameters": {
|
||||||
"hostNames": "vg.no"
|
"hostNames": "vg.no"
|
||||||
@ -235,7 +235,7 @@ exported412-enterprise.json{
|
|||||||
],
|
],
|
||||||
"environments": [
|
"environments": [
|
||||||
{
|
{
|
||||||
"name": "default",
|
"name": ":global:",
|
||||||
"displayName": "Across all environments"
|
"displayName": "Across all environments"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -243,32 +243,32 @@ exported412-enterprise.json{
|
|||||||
{
|
{
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"featureName": "this-is-fun",
|
"featureName": "this-is-fun",
|
||||||
"environment": "default"
|
"environment": ":global:"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"featureName": "version.three.seventeen",
|
"featureName": "version.three.seventeen",
|
||||||
"environment": "default"
|
"environment": ":global:"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"featureName": "in-another-project",
|
"featureName": "in-another-project",
|
||||||
"environment": "default"
|
"environment": ":global:"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"featureName": "with-constraints",
|
"featureName": "with-constraints",
|
||||||
"environment": "default"
|
"environment": ":global:"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"featureName": "another-toggle",
|
"featureName": "another-toggle",
|
||||||
"environment": "default"
|
"environment": ":global:"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"featureName": "toggle-created-in-4-1",
|
"featureName": "toggle-created-in-4-1",
|
||||||
"environment": "default"
|
"environment": ":global:"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user