-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added daily usage rows on file size change, added daily usage c…
…ount towards usage calculation
- Loading branch information
Showing
7 changed files
with
162 additions
and
108 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
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
19 changes: 0 additions & 19 deletions
19
migrations/20241120160129-create-updated-at-index-non-deleted-files.js
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { v4 } from 'uuid'; | ||
import { Usage, UsageType } from './usage.domain'; | ||
|
||
describe('Usage Domain', () => { | ||
const usageAttributes = { | ||
id: v4(), | ||
userId: v4(), | ||
delta: 100, | ||
period: new Date(), | ||
type: UsageType.Daily, | ||
createdAt: new Date(), | ||
updatedAt: new Date(), | ||
}; | ||
|
||
it('When Usage type is Yearly, then isYearly should return true', () => { | ||
const usage = Usage.build({ ...usageAttributes, type: UsageType.Yearly }); | ||
|
||
expect(usage.isYearly()).toBe(true); | ||
expect(usage.isMonthly()).toBe(false); | ||
expect(usage.isDaily()).toBe(false); | ||
}); | ||
|
||
it('When Usage type is Monthly, then isMonthly should return true', () => { | ||
const usage = Usage.build({ ...usageAttributes, type: UsageType.Monthly }); | ||
|
||
expect(usage.isYearly()).toBe(false); | ||
expect(usage.isMonthly()).toBe(true); | ||
expect(usage.isDaily()).toBe(false); | ||
}); | ||
|
||
it('When Usage type is Daily, then isDaily should return true', () => { | ||
const usage = Usage.build({ ...usageAttributes, type: UsageType.Daily }); | ||
|
||
expect(usage.isYearly()).toBe(false); | ||
expect(usage.isMonthly()).toBe(false); | ||
expect(usage.isDaily()).toBe(true); | ||
}); | ||
|
||
it('When instance is created, then period should be parsed to date', () => { | ||
const usage = Usage.build(usageAttributes); | ||
|
||
expect(usage.period).toBeInstanceOf(Date); | ||
}); | ||
}); |
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