This repository has been archived by the owner on Oct 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #357 from tiki/fix/update-state-logic-start-date
Fix/update state logic start date
- Loading branch information
Showing
15 changed files
with
25,246 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Config } from '../../src/config' | ||
|
||
export default new Config({ | ||
company: { | ||
name: "testCompany", | ||
jurisdiction: "Nashville - TN", | ||
terms: "test terms", | ||
privacy: "https://privacy.test" | ||
}, | ||
key: { | ||
publishingId: "e12f5b7b-6b48-4503-8b39-28e4995b5f88", | ||
ios: "testIos", | ||
android: "testAndroid", | ||
product: "testProduct" | ||
} | ||
}) |
2 changes: 1 addition & 1 deletion
2
__tests__/userDisconnectGmail.ts → __tests__/userDisconnectGmail.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
__tests__/userDisconnectRetailer.ts → __tests__/userDisconnectRetailer.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { accountTypes } from '@mytiki/capture-receipt-capacitor'; | ||
import { Store } from '../src/service/store' | ||
import { vi, test, describe, expect, beforeEach, afterEach } from 'vitest' | ||
import { StateAccount } from '../src/service/store/state/state-account'; | ||
import { BulletState } from '../src/components/bullet/bullet-state'; | ||
|
||
describe('Reward payment tests', () => { | ||
|
||
beforeEach(() => { | ||
vi.useFakeTimers() | ||
}) | ||
|
||
afterEach(() => { | ||
vi.useRealTimers() | ||
}) | ||
|
||
test("End of the month and reset", async () => { | ||
const store = new Store(); | ||
await store.initialize(); | ||
store.gmail.update([{ | ||
username: "[email protected]", | ||
type: accountTypes.index.get("GMAIL")!, | ||
isVerified: true | ||
}]) | ||
store.retailer.update([{ | ||
username: "[email protected]", | ||
type: accountTypes.index.get("AMAZON")!, | ||
isVerified: true | ||
}]) | ||
await store.receipt.add("test1"); | ||
await store.receipt.add("test2"); | ||
await store.receipt.add("test3"); | ||
await store.receipt.add("test4"); | ||
await store.receipt.add("test5"); | ||
store.sync.add(); | ||
plus1week(); | ||
store.sync.add(); | ||
plus1week(); | ||
store.sync.add(); | ||
plus1week(); | ||
store.sync.add(); | ||
expect(store.sync.status()).toBe(BulletState.P100) | ||
expect(store.receipt.status.bulletState).toBe(BulletState.P100) | ||
expect((store.gmail as StateAccount).get().value).toBe(BulletState.P100) | ||
expect((store.retailer as StateAccount).get().value).toBe(BulletState.P100) | ||
plus1week() | ||
expect(store.sync.status()).toBe(BulletState.P0) | ||
}) | ||
|
||
}); | ||
|
||
const plus1week = () => { | ||
const date = new Date(); | ||
date.setDate(date.getDate() + 7); | ||
vi.setSystemTime(date); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.