Generate ids using faker for test factories
This commit is contained in:
@@ -25,8 +25,8 @@ describe('Variant Analysis processor', function() {
|
||||
const { access_mismatch_repos, no_codeql_db_repos, not_found_repo_nwos, over_limit_repos } = skippedRepos;
|
||||
|
||||
expect(result).to.eql({
|
||||
'id': 123,
|
||||
'controllerRepoId': 456,
|
||||
'id': mockApiResponse.id,
|
||||
'controllerRepoId': mockApiResponse.controller_repo.id,
|
||||
'query': {
|
||||
'filePath': 'query-file-path',
|
||||
'language': VariantAnalysisQueryLanguage.Javascript,
|
||||
@@ -36,7 +36,7 @@ describe('Variant Analysis processor', function() {
|
||||
'repositories': ['1', '2', '3'],
|
||||
},
|
||||
'status': 'succeeded',
|
||||
'actionsWorkflowRunId': 456,
|
||||
'actionsWorkflowRunId': mockApiResponse.actions_workflow_run_id,
|
||||
'scannedRepos': [
|
||||
transformScannedRepo(VariantAnalysisRepoStatus.Succeeded, scannedRepos[0]),
|
||||
transformScannedRepo(VariantAnalysisRepoStatus.Pending, scannedRepos[1]),
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { faker } from '@faker-js/faker';
|
||||
import {
|
||||
VariantAnalysis as VariantAnalysisApiResponse,
|
||||
VariantAnalysisScannedRepository,
|
||||
@@ -15,19 +16,20 @@ export function createMockApiResponse(
|
||||
scannedRepos: VariantAnalysisScannedRepository[] = createMockScannedRepos(),
|
||||
skippedRepos: VariantAnalysisSkippedRepositories = createMockSkippedRepos()
|
||||
): VariantAnalysisApiResponse {
|
||||
|
||||
const variantAnalysis: VariantAnalysisApiResponse = {
|
||||
id: 123,
|
||||
id: faker.datatype.number(),
|
||||
controller_repo: {
|
||||
id: 456,
|
||||
id: faker.datatype.number(),
|
||||
name: 'pickles',
|
||||
full_name: 'github/pickles',
|
||||
private: false,
|
||||
},
|
||||
actor_id: 123,
|
||||
actor_id: faker.datatype.number(),
|
||||
query_language: VariantAnalysisQueryLanguage.Javascript,
|
||||
query_pack_url: 'https://example.com/foo',
|
||||
status: status,
|
||||
actions_workflow_run_id: 456,
|
||||
actions_workflow_run_id: faker.datatype.number(),
|
||||
scanned_repositories: scannedRepos,
|
||||
skipped_repositories: skippedRepos
|
||||
};
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { faker } from '@faker-js/faker';
|
||||
import { VariantAnalysisQueryLanguage, VariantAnalysisSubmission } from '../../../../remote-queries/shared/variant-analysis';
|
||||
|
||||
export function createMockSubmission(): VariantAnalysisSubmission {
|
||||
return {
|
||||
startTime: 1234,
|
||||
controllerRepoId: 5678,
|
||||
startTime: faker.datatype.number(),
|
||||
controllerRepoId: faker.datatype.number(),
|
||||
actionRepoRef: 'repo-ref',
|
||||
query: {
|
||||
name: 'query-name',
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { faker } from '@faker-js/faker';
|
||||
import {
|
||||
VariantAnalysis,
|
||||
VariantAnalysisQueryLanguage,
|
||||
@@ -14,8 +15,8 @@ export function createMockVariantAnalysis(
|
||||
skippedRepos: VariantAnalysisSkippedRepositories = createMockSkippedRepos()
|
||||
): VariantAnalysis {
|
||||
const variantAnalysis: VariantAnalysis = {
|
||||
id: 123,
|
||||
controllerRepoId: 456,
|
||||
id: faker.datatype.number(),
|
||||
controllerRepoId: faker.datatype.number(),
|
||||
query: {
|
||||
name: 'a-query-name',
|
||||
filePath: 'a-query-file-path',
|
||||
@@ -25,7 +26,7 @@ export function createMockVariantAnalysis(
|
||||
repositories: ['1', '2', '3'],
|
||||
},
|
||||
status: status,
|
||||
actionsWorkflowRunId: 789,
|
||||
actionsWorkflowRunId: faker.datatype.number(),
|
||||
scannedRepos: scannedRepos,
|
||||
skippedRepos: skippedRepos
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user