1- import { LOOKML_GIT_INFO_REPO } from '@app/ingestV2/source/builder/RecipeForm/lookml' ;
21import { GIT_INFO_REPO } from '@app/ingestV2/source/builder/RecipeForm/common' ;
3- import { LOOKML } from '@app/ingestV2/source/builder/RecipeForm/lookml ' ;
4- import { SOURCE_CONFIGS } from '@app/ingestV2/source/builder/RecipeForm/constants ' ;
2+ import { RECIPE_FIELDS } from '@app/ingestV2/source/builder/RecipeForm/constants ' ;
3+ import { LOOKML , LOOKML_GIT_INFO_REPO } from '@app/ingestV2/source/builder/RecipeForm/lookml ' ;
54
65describe ( 'Constants Git Info Integration' , ( ) => {
76 describe ( 'Field Imports' , ( ) => {
@@ -18,65 +17,57 @@ describe('Constants Git Info Integration', () => {
1817
1918 describe ( 'Source Configuration Integration' , ( ) => {
2019 it ( 'should include LOOKML_GIT_INFO_REPO in LOOKML source config' , ( ) => {
21- const lookmlConfig = SOURCE_CONFIGS [ LOOKML ] ;
20+ const lookmlConfig = RECIPE_FIELDS [ LOOKML ] ;
2221 expect ( lookmlConfig ) . toBeDefined ( ) ;
2322 expect ( lookmlConfig . fields ) . toContain ( LOOKML_GIT_INFO_REPO ) ;
2423 } ) ;
2524
2625 it ( 'should have correct field order in LOOKML config' , ( ) => {
27- const lookmlConfig = SOURCE_CONFIGS [ LOOKML ] ;
28- const fields = lookmlConfig . fields ;
29-
26+ const lookmlConfig = RECIPE_FIELDS [ LOOKML ] ;
27+ const { fields } = lookmlConfig ;
28+
3029 // LOOKML_GIT_INFO_REPO should be the first field
3130 expect ( fields [ 0 ] ) . toBe ( LOOKML_GIT_INFO_REPO ) ;
3231 } ) ;
3332
3433 it ( 'should not contain deprecated github_info references' , ( ) => {
35- const lookmlConfig = SOURCE_CONFIGS [ LOOKML ] ;
36- const fields = lookmlConfig . fields ;
37-
34+ const lookmlConfig = RECIPE_FIELDS [ LOOKML ] ;
35+ const { fields } = lookmlConfig ;
36+
3837 // Check that no fields have github_info in their name
39- const githubInfoFields = fields . filter ( field =>
40- field . name && field . name . includes ( 'github_info' )
41- ) ;
38+ const githubInfoFields = fields . filter ( ( field ) => field . name && field . name . includes ( 'github_info' ) ) ;
4239 expect ( githubInfoFields ) . toHaveLength ( 0 ) ;
4340 } ) ;
4441
4542 it ( 'should contain git_info references' , ( ) => {
46- const lookmlConfig = SOURCE_CONFIGS [ LOOKML ] ;
47- const fields = lookmlConfig . fields ;
48-
43+ const lookmlConfig = RECIPE_FIELDS [ LOOKML ] ;
44+ const { fields } = lookmlConfig ;
45+
4946 // Check that fields have git_info in their name
50- const gitInfoFields = fields . filter ( field =>
51- field . name && field . name . includes ( 'git_info' )
52- ) ;
47+ const gitInfoFields = fields . filter ( ( field ) => field . name && field . name . includes ( 'git_info' ) ) ;
5348 expect ( gitInfoFields . length ) . toBeGreaterThan ( 0 ) ;
5449 } ) ;
5550 } ) ;
5651
5752 describe ( 'Field Consistency' , ( ) => {
5853 it ( 'should have consistent field paths for git_info' , ( ) => {
59- const lookmlConfig = SOURCE_CONFIGS [ LOOKML ] ;
60- const fields = lookmlConfig . fields ;
61-
62- const gitInfoFields = fields . filter ( field =>
63- field . name && field . name . includes ( 'git_info' )
64- ) ;
65-
66- gitInfoFields . forEach ( field => {
54+ const lookmlConfig = RECIPE_FIELDS [ LOOKML ] ;
55+ const { fields } = lookmlConfig ;
56+
57+ const gitInfoFields = fields . filter ( ( field ) => field . name && field . name . includes ( 'git_info' ) ) ;
58+
59+ gitInfoFields . forEach ( ( field ) => {
6760 expect ( field . fieldPath ) . toMatch ( / ^ s o u r c e \. c o n f i g \. g i t _ i n f o \. / ) ;
6861 } ) ;
6962 } ) ;
7063
7164 it ( 'should have proper field types for git_info fields' , ( ) => {
72- const lookmlConfig = SOURCE_CONFIGS [ LOOKML ] ;
73- const fields = lookmlConfig . fields ;
74-
75- const gitInfoFields = fields . filter ( field =>
76- field . name && field . name . includes ( 'git_info' )
77- ) ;
78-
79- gitInfoFields . forEach ( field => {
65+ const lookmlConfig = RECIPE_FIELDS [ LOOKML ] ;
66+ const { fields } = lookmlConfig ;
67+
68+ const gitInfoFields = fields . filter ( ( field ) => field . name && field . name . includes ( 'git_info' ) ) ;
69+
70+ gitInfoFields . forEach ( ( field ) => {
8071 expect ( field . type ) . toBeDefined ( ) ;
8172 expect ( [ 'TEXT' , 'SECRET' ] ) . toContain ( field . type ) ;
8273 } ) ;
@@ -85,27 +76,23 @@ describe('Constants Git Info Integration', () => {
8576
8677 describe ( 'Migration from github_info' , ( ) => {
8778 it ( 'should not have any github_info field references' , ( ) => {
88- const lookmlConfig = SOURCE_CONFIGS [ LOOKML ] ;
89- const fields = lookmlConfig . fields ;
90-
79+ const lookmlConfig = RECIPE_FIELDS [ LOOKML ] ;
80+ const { fields } = lookmlConfig ;
81+
9182 // Ensure no fields reference the old github_info structure
92- const oldFieldPaths = fields . filter ( field =>
93- field . fieldPath && field . fieldPath . includes ( 'github_info' )
94- ) ;
83+ const oldFieldPaths = fields . filter ( ( field ) => field . fieldPath && field . fieldPath . includes ( 'github_info' ) ) ;
9584 expect ( oldFieldPaths ) . toHaveLength ( 0 ) ;
9685 } ) ;
9786
9887 it ( 'should have updated field names from github_info to git_info' , ( ) => {
99- const lookmlConfig = SOURCE_CONFIGS [ LOOKML ] ;
100- const fields = lookmlConfig . fields ;
101-
102- const gitInfoFields = fields . filter ( field =>
103- field . name && field . name . includes ( 'git_info' )
104- ) ;
105-
88+ const lookmlConfig = RECIPE_FIELDS [ LOOKML ] ;
89+ const { fields } = lookmlConfig ;
90+
91+ const gitInfoFields = fields . filter ( ( field ) => field . name && field . name . includes ( 'git_info' ) ) ;
92+
10693 expect ( gitInfoFields . length ) . toBeGreaterThan ( 0 ) ;
107-
108- gitInfoFields . forEach ( field => {
94+
95+ gitInfoFields . forEach ( ( field ) => {
10996 expect ( field . name ) . toMatch ( / ^ g i t _ i n f o \. / ) ;
11097 expect ( field . name ) . not . toMatch ( / ^ g i t h u b _ i n f o \. / ) ;
11198 } ) ;
@@ -114,21 +101,19 @@ describe('Constants Git Info Integration', () => {
114101
115102 describe ( 'Field Validation' , ( ) => {
116103 it ( 'should have required fields properly marked' , ( ) => {
117- const lookmlConfig = SOURCE_CONFIGS [ LOOKML ] ;
118- const fields = lookmlConfig . fields ;
119-
120- const requiredFields = fields . filter ( field => field . required === true ) ;
104+ const lookmlConfig = RECIPE_FIELDS [ LOOKML ] ;
105+ const { fields } = lookmlConfig ;
106+
107+ const requiredFields = fields . filter ( ( field ) => field . required === true ) ;
121108 expect ( requiredFields . length ) . toBeGreaterThan ( 0 ) ;
122109 } ) ;
123110
124111 it ( 'should have validation rules for required fields' , ( ) => {
125- const lookmlConfig = SOURCE_CONFIGS [ LOOKML ] ;
126- const fields = lookmlConfig . fields ;
127-
128- const fieldsWithRules = fields . filter ( field =>
129- field . rules && field . rules . length > 0
130- ) ;
131-
112+ const lookmlConfig = RECIPE_FIELDS [ LOOKML ] ;
113+ const { fields } = lookmlConfig ;
114+
115+ const fieldsWithRules = fields . filter ( ( field ) => field . rules && field . rules . length > 0 ) ;
116+
132117 expect ( fieldsWithRules . length ) . toBeGreaterThan ( 0 ) ;
133118 } ) ;
134119 } ) ;
0 commit comments