Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
zhukaihan committed Aug 1, 2024
1 parent d11f76e commit 0e25667
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
17 changes: 4 additions & 13 deletions packages/node/test/local/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,15 @@ import path from 'path';
import { EvaluationFlag } from '@amplitude/experiment-core';
import * as dotenv from 'dotenv';
import { Experiment } from 'src/factory';
import {
FlagConfigFetcher,
InMemoryFlagConfigCache,
LocalEvaluationClient,
} from 'src/index';
import { InMemoryFlagConfigCache, LocalEvaluationClient } from 'src/index';
import { USER_GROUP_TYPE } from 'src/types/cohort';
import { LocalEvaluationDefaults } from 'src/types/config';
import { ExperimentUser } from 'src/types/user';
import { MockHttpClient } from './util/mockHttpClient';
import { COHORTS, FLAGS, NEW_FLAGS, getFlagWithCohort } from './util/mockData';
import { CohortFetcher } from 'src/local/cohort/fetcher';
import {
CohortDownloadError,
CohortMaxSizeExceededError,
SdkCohortApi,
} from 'src/local/cohort/cohort-api';
import { sleep } from 'src/util/time';

import { COHORTS, FLAGS, NEW_FLAGS } from './util/mockData';
import { MockHttpClient } from './util/mockHttpClient';

dotenv.config({ path: path.join(__dirname, '../../', '.env') });

const apiKey = 'server-qz35UwzJ5akieoAdIgzM4m9MIiOLXLoz';
Expand Down
6 changes: 4 additions & 2 deletions packages/node/test/local/util/mockData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@
// FLAGS are normal flags with cohortIds.
// NEW_FLAGS adds a flag with cohortId `anewcohortid` on top of FLAGS.

import { EvaluationFlag } from '@amplitude/experiment-core';

export const getFlagStrWithCohort = (
cohortId: string,
) => `{"key":"flag_${cohortId}","segments":[{
): string => `{"key":"flag_${cohortId}","segments":[{
"conditions":[[{"op":"set contains any","selector":["context","user","cohort_ids"],"values":["${cohortId}"]}]],
"metadata":{"segmentName": "Segment 1"},"variant": "off"
}],"variants": {}}`;

export const getFlagWithCohort = (cohortId: string) =>
export const getFlagWithCohort = (cohortId: string): EvaluationFlag =>
JSON.parse(getFlagStrWithCohort(cohortId));

export const FLAGS = [
Expand Down

0 comments on commit 0e25667

Please sign in to comment.