-- collectPackageJSONCandidates --.
(t *testing.T)
| 1124 | // -- collectPackageJSONCandidates --. |
| 1125 | |
| 1126 | func TestCollectPackageJSONCandidates(t *testing.T) { |
| 1127 | t.Run("react_native", func(t *testing.T) { |
| 1128 | got := collectPackageJSONCandidates(map[string]bool{"react-native": true}) |
| 1129 | require.Len(t, got, 1) |
| 1130 | assert.Equal(t, "react-native", got[0].framework) |
| 1131 | assert.Equal(t, "native", got[0].qsType) |
| 1132 | }) |
| 1133 | |
| 1134 | t.Run("express", func(t *testing.T) { |
| 1135 | got := collectPackageJSONCandidates(map[string]bool{"express": true}) |
| 1136 | require.Len(t, got, 1) |
| 1137 | assert.Equal(t, "express", got[0].framework) |
| 1138 | assert.Equal(t, "regular", got[0].qsType) |
| 1139 | }) |
| 1140 | |
| 1141 | t.Run("hono", func(t *testing.T) { |
| 1142 | got := collectPackageJSONCandidates(map[string]bool{"hono": true}) |
| 1143 | require.Len(t, got, 1) |
| 1144 | assert.Equal(t, "hono", got[0].framework) |
| 1145 | assert.Equal(t, "regular", got[0].qsType) |
| 1146 | }) |
| 1147 | |
| 1148 | t.Run("fastify", func(t *testing.T) { |
| 1149 | got := collectPackageJSONCandidates(map[string]bool{"fastify": true}) |
| 1150 | require.Len(t, got, 1) |
| 1151 | assert.Equal(t, "fastify", got[0].framework) |
| 1152 | assert.Equal(t, "regular", got[0].qsType) |
| 1153 | }) |
| 1154 | |
| 1155 | t.Run("empty_deps_returns_no_candidates", func(t *testing.T) { |
| 1156 | got := collectPackageJSONCandidates(map[string]bool{}) |
| 1157 | assert.Empty(t, got) |
| 1158 | }) |
| 1159 | |
| 1160 | t.Run("multiple_deps_returns_multiple_candidates", func(t *testing.T) { |
| 1161 | deps := map[string]bool{"express": true, "hono": true, "fastify": true} |
| 1162 | got := collectPackageJSONCandidates(deps) |
| 1163 | assert.Len(t, got, 3) |
| 1164 | }) |
| 1165 | |
| 1166 | t.Run("unrecognised_dep_returns_no_candidates", func(t *testing.T) { |
| 1167 | got := collectPackageJSONCandidates(map[string]bool{"some-random-lib": true}) |
| 1168 | assert.Empty(t, got) |
| 1169 | }) |
| 1170 | } |
| 1171 | |
| 1172 | // -- detectionFriendlyAppType --. |
| 1173 |
nothing calls this directly
no test coverage detected