Skip to content

Commit

Permalink
test: add tests for accounts configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
aripalo committed Nov 21, 2024
1 parent 6143af6 commit b793e7f
Show file tree
Hide file tree
Showing 3 changed files with 193 additions and 1 deletion.
120 changes: 120 additions & 0 deletions src/configurations/__snapshots__/accounts.test.ts.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

72 changes: 72 additions & 0 deletions src/configurations/accounts.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import {
AccountType,
emptyMockAccountProps,
AccountStrategy,
} from "./accounts";

test("AccountType", () => {
expect(AccountType).toMatchSnapshot();
});

test("emptyMockAccountProps", () => {
expect(emptyMockAccountProps).toMatchSnapshot();
});

describe("AccountStrategy", () => {
test("one", () => {
expect(
AccountStrategy.one({
shared: {
id: "123456789012",
config: {
key: "value",
},
},
}),
).toMatchSnapshot();
});

test("two", () => {
expect(
AccountStrategy.two({
dev: {
id: "123456789012",
config: {
foo: "bar",
},
},
prod: {
id: "213456789012",
config: {
baz: "quux",
},
},
}),
).toMatchSnapshot();
});

test("three", () => {
expect(
AccountStrategy.three({
dev: {
id: "111111111111",
config: {
cidr: "172.16.0.0/22",
},
},
preprod: {
id: "222222222222",
config: {
cidr: "172.16.4.0/22",
},
},
prod: {
id: "333333333333",
config: {
cidr: "172.16.8.0/22",
},
},
}),
).toMatchSnapshot();
});
});
2 changes: 1 addition & 1 deletion src/configurations/accounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export interface AccountStrategyThreeProps {
readonly [AccountType.PROD]: AccountConfiguration;
}

const emptyMockAccountProps: AccountConfiguration = {
export const emptyMockAccountProps: AccountConfiguration = {
id: "123456789012",
};

Expand Down

0 comments on commit b793e7f

Please sign in to comment.