1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

fix: remove stray only (#2589)

This removes stray onlys in our tests and adds a linter rule that will
error if only is present. Also updates the test result of one of our
tests as a result of [this pull
request](https://github.com/Unleash/unleash/pull/2344)
This commit is contained in:
Fredrik Strand Oseberg 2022-12-02 13:10:39 +01:00 committed by GitHub
parent 055c2acddd
commit bc3744d565
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 13 additions and 5 deletions

View File

@ -9,7 +9,7 @@
"ecmaVersion": 2019,
"project": "./tsconfig.json"
},
"plugins": ["@typescript-eslint", "prettier", "import"],
"plugins": ["@typescript-eslint", "prettier", "import", "no-only-tests"],
"root": true,
"rules": {
"@typescript-eslint/no-var-requires": 0,
@ -26,6 +26,7 @@
"no-param-reassign": "error",
"no-return-await": "error",
"max-nested-callbacks": "off",
"no-only-tests/no-only-tests": "error",
"new-cap": [
"error",
{

View File

@ -170,6 +170,7 @@
"eslint-config-airbnb-typescript": "17.0.0",
"eslint-config-prettier": "8.5.0",
"eslint-plugin-import": "2.26.0",
"eslint-plugin-no-only-tests": "^3.1.0",
"eslint-plugin-prettier": "4.2.1",
"faker": "5.5.3",
"fast-check": "3.3.0",

View File

@ -167,6 +167,7 @@ class FeatureToggleService {
projectId,
}: IFeatureContext): Promise<void> {
const id = await this.featureToggleStore.getProjectId(featureName);
if (id !== projectId) {
throw new InvalidOperationError(
`The operation could not be completed. The feature exists, but the provided project id ("${projectId}") does not match the project that the feature belongs to ("${id}"). Try using "${id}" in the request URL instead of "${projectId}".`,

View File

@ -515,7 +515,7 @@ test('Trying to toggle environment that does not exist yields 404', async () =>
test('Getting feature that does not exist should yield 404', async () => {
await app.request
.get('/api/admin/projects/default/features/non.existing.feature')
.expect(404);
.expect(403);
});
describe('Interacting with features using project IDs that belong to other projects', () => {
@ -2630,7 +2630,7 @@ test('should return strategies in correct order when new strategies are added',
expect(strategiesReOrdered[3].id).toBe(strategyThree.id);
});
test.only('should create a strategy with segments', async () => {
test('should create a strategy with segments', async () => {
const feature = { name: uuidv4(), impressionData: false };
await createFeatureToggle(feature.name);
const segment = await createSegment('segmentOne');
@ -2678,7 +2678,7 @@ test.only('should create a strategy with segments', async () => {
});
});
test.only('should add multiple segments to a strategy', async () => {
test('should add multiple segments to a strategy', async () => {
const feature = { name: uuidv4(), impressionData: false };
await createFeatureToggle(feature.name);
const segment = await createSegment('seg1');

View File

@ -982,7 +982,7 @@ test('should return all features when specified', async () => {
});
});
test.only('should return maxAge header on options call', async () => {
test('should return maxAge header on options call', async () => {
await app.request
.options('/api/frontend')
.set('Origin', 'https://example.com')

View File

@ -3185,6 +3185,11 @@ eslint-plugin-import@2.26.0:
resolve "^1.22.0"
tsconfig-paths "^3.14.1"
eslint-plugin-no-only-tests@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-no-only-tests/-/eslint-plugin-no-only-tests-3.1.0.tgz#f38e4935c6c6c4842bf158b64aaa20c366fe171b"
integrity sha512-Lf4YW/bL6Un1R6A76pRZyE1dl1vr31G/ev8UzIc/geCgFWyrKil8hVjYqWVKGB/UIGmb6Slzs9T0wNezdSVegw==
eslint-plugin-prettier@4.2.1:
version "4.2.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.1.tgz#651cbb88b1dab98bfd42f017a12fa6b2d993f94b"