Skip to content

Instantly share code, notes, and snippets.

View lgandecki's full-sized avatar

Łukasz Gandecki lgandecki

View GitHub Profile
@lgandecki
lgandecki / dynamoSdkToCdk.ts
Created December 30, 2020 07:56
Dynamo SDK to CDK definition
import _ from "lodash";
function deCapitalizeFirstLetter(string: string) {
return string.charAt(0).toLowerCase() + string.slice(1);
}
function replaceKeysDeep(obj: object | unknown[]) {
// @ts-ignore
return _.transform(obj, function (
result: { [key: string]: unknown },
import { Background } from "xolvio-ui/elements/Background";
import { Title } from "xolvio-ui/components/Title";
import { CenteredContentWrapper } from "xolvio-ui/helpers/CenteredContentWrapper";
export const Services = () => (
<CenteredContentWrapper>
<Background/>
<Title title="hello" subheading="world" />
</CenteredContentWrapper>
);
// Configure our plugin in your app's webpack.config.js like this:
plugins: [
new StorybookWebpackFederationPlugin({
remotes: ["xolvio-ui"],
})
]
// Configure our plugin in your Storybook webpack.config.js like this:
plugins: [
new StorybookWebpackFederationPlugin({
name: "xolvio-ui",
files: {
paths: ["./src/**/*.ts{,x}"]
}
})
]
exports.estimateShipping = ({price, weight}) => {
if (price > 1000) {
return 0
}
return weight / 2;
};
test("estimateShipping should be calculated as 1 dollar per 2 pounds for an item with a price of 1000 or below", () => {
expect(estimateShipping({price: 1000, weight: 500})).toEqual(250)
});
exports.estimateShipping = ({price, weight}) => {
if (price > 1000) {
return 0
}
};
test("estimateShipping should be 0 for an item with a price over 1000", () => {
expect(estimateShipping({price: 1001})).toStrictEqual(0)
});
const { estimateShipping } = require("./estimateShipping");
test("estimateShipping should be 0 for an item with a price over 1000", () => {
expect(estimateShipping({price: 1001})).toEqual(0)
});
test("estimateShipping should be calculated as 1 dollar per 2 pounds for an item with a price of 1000 or below", () => {
expect(estimateShipping({price: 1000, weight: 500})).toEqual(250)
});
const { estimateShipping } = require("./estimateShipping");
test.todo("estimateShipping should be 0 for an item with a price over 1000");
test.todo("estimateShipping should be calculated as 1 dollar per 2 pounds for an item with a price of 1000 or below");