-
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.
* chore: some rework * chore: testing server * fix: removed action
- Loading branch information
1 parent
6a6f64c
commit 707bd8c
Showing
17 changed files
with
288 additions
and
75 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 |
---|---|---|
@@ -1 +1,2 @@ | ||
dist | ||
node_modules |
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 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
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
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,9 @@ | ||
import { log } from "../utils/logger" | ||
|
||
export default defineNitroPlugin(() => { | ||
log('Server started!') | ||
|
||
setInterval(() => { | ||
log('Server is OK...') | ||
}, 60000) | ||
}) |
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,12 @@ | ||
export function log(...args: string[]) { | ||
console.log(`[${new Date().toLocaleString('en-US', { | ||
year: 'numeric', | ||
month: 'numeric', | ||
day: 'numeric', | ||
timeZone: 'UTC', | ||
hour12: false, | ||
hour: 'numeric', | ||
minute: 'numeric', | ||
second: 'numeric', | ||
})}]`, ...args) | ||
} |
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,68 @@ | ||
import {getDateMinusMinutes,getDatePlusMinutes,getDatePlusSeconds} from '../date' | ||
import { describe, expect, it } from 'vitest' | ||
|
||
describe('getDatePlusMinutes()', () => { | ||
it('returns the current date and time plus the specified minutes', () => { | ||
const minutesToAdd = 5 | ||
const result = getDatePlusMinutes(minutesToAdd) | ||
const expected = new Date(Date.now() + minutesToAdd * 60 * 1000) | ||
expect(expected.getTime() - result.getTime()).toBeLessThanOrEqual(1) | ||
}) | ||
|
||
it('handles the edge case of zero minutes', () => { | ||
const result = getDatePlusMinutes(0) | ||
const expected = new Date() | ||
expect(expected.getTime() - result.getTime()).toBeLessThanOrEqual(1) | ||
}) | ||
|
||
it('handles the edge case of negative minutes', () => { | ||
const minutesToAdd = -5 | ||
const result = getDatePlusMinutes(minutesToAdd) | ||
const expected = new Date(Date.now() + minutesToAdd * 60 * 1000) | ||
expect(expected.getTime() - result.getTime()).toBeLessThanOrEqual(1) | ||
}) | ||
}) | ||
|
||
describe('getDateMinusMinutes()', () => { | ||
it('returns the current date and time minus the specified minutes', () => { | ||
const minutesToSubtract = 5 | ||
const result = getDateMinusMinutes(minutesToSubtract) | ||
const expected = new Date(Date.now() - minutesToSubtract * 60 * 1000) | ||
expect(expected.getTime() - result.getTime()).toBeLessThanOrEqual(1) | ||
}) | ||
|
||
it('handles the edge case of zero minutes', () => { | ||
const result = getDateMinusMinutes(0) | ||
const expected = new Date() | ||
expect(expected.getTime() - result.getTime()).toBeLessThanOrEqual(1) | ||
}) | ||
|
||
it('handles the edge case of negative minutes', () => { | ||
const minutesToSubtract = -5 | ||
const result = getDateMinusMinutes(minutesToSubtract) | ||
const expected = new Date(Date.now() - minutesToSubtract * 60 * 1000) | ||
expect(expected.getTime() - result.getTime()).toBeLessThanOrEqual(1) | ||
}) | ||
}) | ||
|
||
describe('getDatePlusSeconds()', () => { | ||
it('returns the current date and time plus the specified seconds', () => { | ||
const secondsToAdd = 5 | ||
const result = getDatePlusSeconds(secondsToAdd) | ||
const expected = new Date(Date.now() + secondsToAdd * 1000) | ||
expect(expected.getTime() - result.getTime()).toBeLessThanOrEqual(1) | ||
}) | ||
|
||
it('handles the edge case of zero seconds', () => { | ||
const result = getDatePlusSeconds(0) | ||
const expected = new Date() | ||
expect(expected.getTime() - result.getTime()).toBeLessThanOrEqual(1) | ||
}) | ||
|
||
it('handles the edge case of negative seconds', () => { | ||
const secondsToAdd = -5 | ||
const result = getDatePlusSeconds(secondsToAdd) | ||
const expected = new Date(Date.now() + secondsToAdd * 1000) | ||
expect(expected.getTime() - result.getTime()).toBeLessThanOrEqual(1) | ||
}) | ||
}) |
Oops, something went wrong.