+
Skip to content

Extend the free trial to 5 days #101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![2 day free preview](https://img.shields.io/badge/trial-2%20day-orange)](https://getlocalci.com/pricing/?utm_medium=extension&utm_source=readme)
[![5 day free preview](https://img.shields.io/badge/trial-5%20day-orange)](https://getlocalci.com/pricing/?utm_medium=extension&utm_source=readme)
[![Buy license key](https://img.shields.io/badge/%24-paid-orange)](https://getlocalci.com/pricing/?utm_medium=extension&utm_source=readme)
[![Platform: macOS](https://img.shields.io/badge/platform-macOS-yellow)](https://en.wikipedia.org/wiki/MacOS)
[![Requires CircleCI®](https://img.shields.io/badge/requires-CirlcleCI%C2%AE-yellow)](https://circleci.com/docs/2.0/first-steps/)
Expand Down Expand Up @@ -53,7 +53,7 @@ Find out in seconds whether the setup is right, all in your local.

Local CI requires a [license key](https://getlocalci.com/pricing/?utm_medium=extension&utm_source=readme) for $10 per month.

But first you'll get a free 2-day preview, no sign-up or credit card needed.
But first you'll get a free 5-day preview, no sign-up or credit card needed.

## Requirements

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,9 @@
},
"badges": [
{
"url": "https://img.shields.io/badge/trial-2%20day-orange",
"url": "https://img.shields.io/badge/trial-5%20day-orange",
"href": "https://getlocalci.com/pricing/?utm_medium=extension&utm_source=badge",
"description": "2 day free preview"
"description": "5 day free preview"
},
{
"url": "https://img.shields.io/badge/%24-paid-orange",
Expand Down
2 changes: 1 addition & 1 deletion src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const LICENSE_KEY = 'local-ci.license.key';
export const LICENSE_VALIDITY = 'local-ci.license.validity';
export const LICENSE_VALIDITY_CACHE_EXPIRATION =
'local-ci.license.cache.expiration';
export const TRIAL_LENGTH_IN_MILLISECONDS = 172800000; // 2 days.
export const TRIAL_LENGTH_IN_MILLISECONDS = 432000000; // 5 days.
export const EXTENDED_TRIAL_LENGTH_IN_MILLISECONDS = 1296000000; // 15 days.
export const HAS_EXTENDED_TRIAL = 'local-ci.license.trial-extended.survey';
export const TRIAL_STARTED_TIMESTAMP =
Expand Down
14 changes: 8 additions & 6 deletions src/test/suite/utils/getMillisecondsRemainingInTrial.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,26 @@ import { TRIAL_LENGTH_IN_MILLISECONDS } from '../../../constants';
import getMillisecondsRemainingInTrial from '../../../utils/getMillisecondsRemainingInTrial';

const hourInMilliseconds = 3600000;
const dayInMilliseconds = 86400000;

suite('getMillisecondsRemainingInTrial', () => {
test('entire trial remaining', () => {
const time = new Date().getTime();
assert.strictEqual(
getMillisecondsRemainingInTrial(time, time, TRIAL_LENGTH_IN_MILLISECONDS),
172800000
TRIAL_LENGTH_IN_MILLISECONDS
);
});

test('1 day remaining', () => {
test('4 days remaining', () => {
const time = new Date().getTime();
assert.strictEqual(
getMillisecondsRemainingInTrial(
time,
time - 24 * hourInMilliseconds,
TRIAL_LENGTH_IN_MILLISECONDS
),
86400000
4 * dayInMilliseconds
);
});

Expand All @@ -29,10 +31,10 @@ suite('getMillisecondsRemainingInTrial', () => {
assert.strictEqual(
getMillisecondsRemainingInTrial(
time,
time - 47 * hourInMilliseconds,
time - (4 * dayInMilliseconds + 23 * hourInMilliseconds),
TRIAL_LENGTH_IN_MILLISECONDS
),
3600000
hourInMilliseconds
);
});

Expand All @@ -41,7 +43,7 @@ suite('getMillisecondsRemainingInTrial', () => {
assert.strictEqual(
getMillisecondsRemainingInTrial(
time,
time - 48 * hourInMilliseconds,
time - 5 * dayInMilliseconds,
TRIAL_LENGTH_IN_MILLISECONDS
),
0
Expand Down
26 changes: 18 additions & 8 deletions src/test/suite/utils/isTrialExpired.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ mocha.afterEach(() => {
sinon.restore();
});

const dayInMilliseconds = 86400000;
const extendedTrial =
TRIAL_LENGTH_IN_MILLISECONDS + EXTENDED_TRIAL_LENGTH_IN_MILLISECONDS;

Expand All @@ -22,10 +23,10 @@ suite('isTrialExpired', () => {
);
});

test('preview began 2 days and 1 millisecond ago', () => {
test('preview began 5 days and 1 millisecond ago', () => {
assert.strictEqual(
isTrialExpired(
new Date().getTime() - 172800001,
new Date().getTime() - (5 * dayInMilliseconds + 1),
TRIAL_LENGTH_IN_MILLISECONDS
),
true
Expand All @@ -35,7 +36,7 @@ suite('isTrialExpired', () => {
test('preview began a week ago', () => {
assert.strictEqual(
isTrialExpired(
new Date().getTime() - 604800000,
new Date().getTime() - 7 * dayInMilliseconds,
TRIAL_LENGTH_IN_MILLISECONDS
),
true
Expand All @@ -49,23 +50,32 @@ suite('isTrialExpired', () => {
);
});

test('preview began 2 days and 10 milliseconds ago and was extended', () => {
test('preview began 5 days and 10 milliseconds ago and was extended', () => {
assert.strictEqual(
isTrialExpired(new Date().getTime() - 172800010, extendedTrial),
isTrialExpired(
new Date().getTime() - (5 * dayInMilliseconds + 10),
extendedTrial
),
false
);
});

test('preview began a week ago and was extended', () => {
assert.strictEqual(
isTrialExpired(new Date().getTime() - 604800000, extendedTrial),
isTrialExpired(
new Date().getTime() - 7 * dayInMilliseconds,
extendedTrial
),
false
);
});

test('preview began 17 days and 1 millisecond ago and was extended', () => {
test('preview began 20 days and 1 millisecond ago and was extended', () => {
assert.strictEqual(
isTrialExpired(new Date().getTime() - 1468800001, extendedTrial),
isTrialExpired(
new Date().getTime() - 20 * dayInMilliseconds,
extendedTrial
),
true
);
});
Expand Down
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载