mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix CRD.getPreferedVersion() to work based on apiVersion (#4553)
* Fix CRD.getPreferedVersion() to work based on apiVersion Signed-off-by: Sebastian Malton <sebastian@malton.name> * Add tests Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
2a31c5a0d5
commit
6a97a7b35b
2 files changed
+62
-50
No files matched your search
@@ -19,10 +19,10 @@
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
import { CustomResourceDefinition } from "../endpoints";
|
||||
import { CustomResourceDefinition, CustomResourceDefinitionSpec } from "../endpoints";
|
||||
|
||||
describe("Crds", () => {
|
||||
describe("getVersion", () => {
|
||||
describe("getVersion()", () => {
|
||||
it("should throw if none of the versions are served", () => {
|
||||
const crd = new CustomResourceDefinition({
|
||||
apiVersion: "apiextensions.k8s.io/v1",
|
||||
@@ -136,7 +136,7 @@ describe("Crds", () => {
|
||||
expect(crd.getVersion()).toBe("123");
|
||||
});
|
||||
|
||||
it("should get the version name from the version field", () => {
|
||||
it("should get the version name from the version field, ignoring versions on v1beta", () => {
|
||||
const crd = new CustomResourceDefinition({
|
||||
apiVersion: "apiextensions.k8s.io/v1beta1",
|
||||
kind: "CustomResourceDefinition",
|
||||
@@ -147,7 +147,14 @@ describe("Crds", () => {
|
||||
},
|
||||
spec: {
|
||||
version: "abc",
|
||||
},
|
||||
versions: [
|
||||
{
|
||||
name: "foobar",
|
||||
served: true,
|
||||
storage: true,
|
||||
},
|
||||
],
|
||||
} as CustomResourceDefinitionSpec,
|
||||
});
|
||||
|
||||
expect(crd.getVersion()).toBe("abc");
|
||||
|
||||
Reference in new issue
Block a user