Skip to content

Commit

Permalink
refactor!: Rename library-info to be more intention revealing
Browse files Browse the repository at this point in the history
Rename `library-info` to `tracking-tag` to be more descriptive and intention revealing.

This change makes the mocking advice added in #448 less confusing as the module name maps to the intent.

BREAKING CHANGE: `"@guardian/cdk/lib/constants/library-info"` renamed to `"@guardian/cdk/lib/constants/tracking-tag"`

Update the mock path in `jest.setup.js` - `"@guardian/cdk/lib/constants/library-info"` becomes `"@guardian/cdk/lib/constants/tracking-tag"`.
  • Loading branch information
akash1810 committed Apr 17, 2021
1 parent 26c2e6d commit 317de80
Show file tree
Hide file tree
Showing 12 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion docs/001-general-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ This can be done with a few config changes.
First, create `jest.setup.js` and add the global mock:

```javascript
jest.mock("@guardian/cdk/lib/constants/library-info");
jest.mock("@guardian/cdk/lib/constants/tracking-tag");
```

Next, edit `jest.config.js` setting the [`setupFilesAfterEnv`](https://jestjs.io/docs/configuration#setupfilesafterenv-array) property:
Expand Down
2 changes: 1 addition & 1 deletion jest.setup.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
jest.mock("./src/constants/library-info");
jest.mock("./src/constants/tracking-tag");
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/constructs/autoscaling/asg.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { InstanceType, UserData, Vpc } from "@aws-cdk/aws-ec2";
import { ApplicationProtocol } from "@aws-cdk/aws-elasticloadbalancingv2";
import { Stack } from "@aws-cdk/core";
import { Stage } from "../../constants";
import { TrackingTag } from "../../constants/library-info";
import { TrackingTag } from "../../constants/tracking-tag";
import type { Resource, SynthedStack } from "../../utils/test";
import { alphabeticalTags, findResourceByTypeAndLogicalId, simpleGuStackForTesting } from "../../utils/test";
import type { AppIdentity } from "../core/identity";
Expand Down
2 changes: 1 addition & 1 deletion src/constructs/core/stack.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { SynthUtils } from "@aws-cdk/assert";
import { Role, ServicePrincipal } from "@aws-cdk/aws-iam";
import { App } from "@aws-cdk/core";
import { Stage, Stages } from "../../constants";
import { TrackingTag } from "../../constants/library-info";
import { TrackingTag } from "../../constants/tracking-tag";
import { alphabeticalTags, simpleGuStackForTesting } from "../../utils/test";
import type { SynthedStack } from "../../utils/test";
import { GuParameter } from "./parameters";
Expand Down
2 changes: 1 addition & 1 deletion src/constructs/core/stack.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { App, StackProps } from "@aws-cdk/core";
import { Stack, Tags } from "@aws-cdk/core";
import { Stage } from "../../constants";
import { TrackingTag } from "../../constants/library-info";
import { TrackingTag } from "../../constants/tracking-tag";
import type { StackStageIdentity } from "./identity";
import type { GuStageDependentValue } from "./mappings";
import { GuStageMapping } from "./mappings";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import "../../../utils/test/jest";
import { SynthUtils } from "@aws-cdk/assert";
import { Vpc } from "@aws-cdk/aws-ec2";
import { Stack } from "@aws-cdk/core";
import { TrackingTag } from "../../../constants/library-info";
import { TrackingTag } from "../../../constants/tracking-tag";
import type { SynthedStack } from "../../../utils/test";
import { alphabeticalTags, simpleGuStackForTesting } from "../../../utils/test";
import type { AppIdentity } from "../../core/identity";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import "../../../utils/test/jest";
import { Vpc } from "@aws-cdk/aws-ec2";
import { ApplicationProtocol } from "@aws-cdk/aws-elasticloadbalancingv2";
import { Stack } from "@aws-cdk/core";
import { TrackingTag } from "../../../constants/library-info";
import { TrackingTag } from "../../../constants/tracking-tag";
import { alphabeticalTags, simpleGuStackForTesting } from "../../../utils/test";
import type { AppIdentity } from "../../core/identity";
import { GuApplicationTargetGroup } from "./application-target-group";
Expand Down
2 changes: 1 addition & 1 deletion src/constructs/loadbalancing/elb.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import "../../utils/test/jest";
import { SynthUtils } from "@aws-cdk/assert/lib/synth-utils";
import { Vpc } from "@aws-cdk/aws-ec2";
import { Stack } from "@aws-cdk/core";
import { TrackingTag } from "../../constants/library-info";
import { TrackingTag } from "../../constants/tracking-tag";
import { alphabeticalTags, simpleGuStackForTesting } from "../../utils/test";
import type { SynthedStack } from "../../utils/test";
import type { AppIdentity } from "../core/identity";
Expand Down
2 changes: 1 addition & 1 deletion src/constructs/rds/instance.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import "../../utils/test/jest";
import { Vpc } from "@aws-cdk/aws-ec2";
import { DatabaseInstanceEngine, ParameterGroup, PostgresEngineVersion } from "@aws-cdk/aws-rds";
import { Stack } from "@aws-cdk/core";
import { TrackingTag } from "../../constants/library-info";
import { TrackingTag } from "../../constants/tracking-tag";
import { alphabeticalTags, simpleGuStackForTesting } from "../../utils/test";
import { GuDatabaseInstance } from "./instance";

Expand Down
2 changes: 1 addition & 1 deletion src/patterns/ec2-app.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import "@aws-cdk/assert/jest";
import { SynthUtils } from "@aws-cdk/assert";
import { Stage } from "../constants";
import { TrackingTag } from "../constants/library-info";
import { TrackingTag } from "../constants/tracking-tag";
import { GuDistributionBucketParameter, GuPrivateConfigBucketParameter } from "../constructs/core";
import { alphabeticalTags, simpleGuStackForTesting } from "../utils/test";
import { GuApplicationPorts, GuEc2App, GuNodeApp, GuPlayApp } from "./ec2-app";
Expand Down

0 comments on commit 317de80

Please sign in to comment.