Skip to content

Commit

Permalink
remove unused import and added a test for core construct
Browse files Browse the repository at this point in the history
  • Loading branch information
iliapolo committed Oct 18, 2020
1 parent 9d49f0f commit de3d49f
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions packages/@aws-cdk/aws-eks/test/test.cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import * as lambda from '@aws-cdk/aws-lambda';
import * as cdk from '@aws-cdk/core';
import * as cdk8s from 'cdk8s';
import * as constructs from 'constructs';
import { Construct } from 'constructs';
import { Test } from 'nodeunit';
import * as YAML from 'yaml';
import * as eks from '../lib';
Expand All @@ -23,7 +22,7 @@ const CLUSTER_VERSION = eks.KubernetesVersion.V1_18;

export = {

'throws when a non cdk8s chart is added as cdk8s chart'(test: Test) {
'throws when a non cdk8s chart construct is added as cdk8s chart'(test: Test) {

const { stack } = testFixture();

Expand All @@ -39,6 +38,22 @@ export = {

},

'throws when a core construct is added as cdk8s chart'(test: Test) {

const { stack } = testFixture();

const cluster = new eks.Cluster(stack, 'Cluster', {
version: CLUSTER_VERSION,
});

// create a plain construct, not a cdk8s chart
const someConstruct = new cdk.Construct(stack, 'SomeConstruct');

test.throws(() => cluster.addCdk8sChart('chart', someConstruct), /Invalid cdk8s chart. Must contain a \'toJson\' method, but found undefined/);
test.done();

},

'cdk8s chart can be added to cluster'(test: Test) {

const { stack } = testFixture();
Expand Down

0 comments on commit de3d49f

Please sign in to comment.