Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

core: use generic snapshot for pricing test

Abdullah Atta3f73b471218c
diff --git a/packages/core/__e2e__/__snapshots__/pricing.test.js.snap b/packages/core/__e2e__/__snapshots__/pricing.test.js.snap
index 0797f5d19..bbb806875 100644
--- a/packages/core/__e2e__/__snapshots__/pricing.test.js.snap
+++ b/packages/core/__e2e__/__snapshots__/pricing.test.js.snap
@@ -2,81 +2,81 @@
exports[`get android pricing tier get monthly android tier: monthly-android-pricing 1`] = `
Object {
- "country": "Pakistan",
- "countryCode": "PK",
- "discount": 78,
+ "country": Any<String>,
+ "countryCode": Any<String>,
+ "discount": Any<Number>,
"sku": "com.streetwriters.notesnook.sub.mo.tier3",
}
`;
exports[`get android pricing tier get yearly android tier: yearly-android-pricing 1`] = `
Object {
- "country": "Pakistan",
- "countryCode": "PK",
- "discount": 80,
+ "country": Any<String>,
+ "countryCode": Any<String>,
+ "discount": Any<Number>,
"sku": "com.streetwriters.notesnook.sub.yr.tier3",
}
`;
exports[`get ios pricing tier get monthly ios tier: monthly-ios-pricing 1`] = `
Object {
- "country": "Pakistan",
- "countryCode": "PK",
- "discount": 78,
+ "country": Any<String>,
+ "countryCode": Any<String>,
+ "discount": Any<Number>,
"sku": "com.streetwriters.notesnook.sub.mo.tier3",
}
`;
exports[`get ios pricing tier get yearly ios tier: yearly-ios-pricing 1`] = `
Object {
- "country": "Pakistan",
- "countryCode": "PK",
- "discount": 80,
+ "country": Any<String>,
+ "countryCode": Any<String>,
+ "discount": Any<Number>,
"sku": "com.streetwriters.notesnook.sub.yr.tier3",
}
`;
exports[`get monthly price: monthly-pricing 1`] = `
Object {
- "country": "Pakistan",
- "countryCode": "PK",
- "discount": 78,
- "price": 0.99,
+ "country": Any<String>,
+ "countryCode": Any<String>,
+ "discount": Any<Number>,
+ "price": Any<Number>,
}
`;
exports[`get undefined price: monthly-pricing 1`] = `
Object {
- "country": "Pakistan",
- "countryCode": "PK",
- "discount": 78,
- "price": 0.99,
+ "country": Any<String>,
+ "countryCode": Any<String>,
+ "discount": Any<Number>,
+ "price": Any<Number>,
}
`;
exports[`get web pricing tier get monthly web tier: monthly-web-pricing 1`] = `
Object {
- "country": "Pakistan",
- "countryCode": "PK",
- "discount": 78,
+ "country": Any<String>,
+ "countryCode": Any<String>,
+ "discount": Any<Number>,
"sku": "763943",
}
`;
exports[`get web pricing tier get yearly web tier: yearly-web-pricing 1`] = `
Object {
- "country": "Pakistan",
- "countryCode": "PK",
- "discount": 80,
+ "country": Any<String>,
+ "countryCode": Any<String>,
+ "discount": Any<Number>,
"sku": "763945",
}
`;
exports[`get yearly price: yearly-pricing 1`] = `
Object {
- "country": "Pakistan",
- "countryCode": "PK",
- "discount": 80,
- "price": 9.99,
+ "country": Any<String>,
+ "countryCode": Any<String>,
+ "discount": Any<Number>,
+ "price": Any<Number>,
}
`;
diff --git a/packages/core/__e2e__/pricing.test.js b/packages/core/__e2e__/pricing.test.js
index 4947d5e3d..96c088c48 100644
--- a/packages/core/__e2e__/pricing.test.js
+++ b/packages/core/__e2e__/pricing.test.js
@@ -22,7 +22,15 @@ import Pricing from "../api/pricing";
test.each(["monthly", "yearly", undefined])(`get %s price`, async (period) => {
const pricing = new Pricing();
const price = await pricing.price(period);
- expect(price).toMatchSnapshot(`${period || "monthly"}-pricing`);
+ expect(price).toMatchSnapshot(
+ {
+ country: expect.any(String),
+ countryCode: expect.any(String),
+ discount: expect.any(Number),
+ price: expect.any(Number)
+ },
+ `${period || "monthly"}-pricing`
+ );
});
describe.each(["android", "ios", "web"])(`get %s pricing tier`, (platform) => {
@@ -31,7 +39,14 @@ describe.each(["android", "ios", "web"])(`get %s pricing tier`, (platform) => {
async (period) => {
const pricing = new Pricing();
const price = await pricing.sku(platform, period);
- expect(price).toMatchSnapshot(`${period}-${platform}-pricing`);
+ expect(price).toMatchSnapshot(
+ {
+ country: expect.any(String),
+ countryCode: expect.any(String),
+ discount: expect.any(Number)
+ },
+ `${period}-${platform}-pricing`
+ );
}
);
});