-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
333 additions
and
345 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,16 +1,16 @@ | ||
{ | ||
"env": { | ||
"es2021": true, | ||
"node": true | ||
}, | ||
"extends": ["standard-with-typescript", "prettier"], | ||
"overrides": [], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": "latest", | ||
"sourceType": "module", | ||
"project": "./tsconfig.json" | ||
}, | ||
"rules": {}, | ||
"ignorePatterns": ["coverage", "dist"] | ||
} | ||
"env": { | ||
"es2021": true, | ||
"node": true | ||
}, | ||
"extends": ["standard-with-typescript", "prettier"], | ||
"overrides": [], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": "latest", | ||
"sourceType": "module", | ||
"project": "./tsconfig.json" | ||
}, | ||
"rules": {}, | ||
"ignorePatterns": ["coverage", "dist"] | ||
} |
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 |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
"printWidth": 120, | ||
"trailingComma": "all", | ||
"singleQuote": true | ||
} | ||
} |
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 |
---|---|---|
@@ -1,31 +1,36 @@ | ||
import { HeatMap } from '../../../src/models'; | ||
import { IHeatMap } from '../../../src/interfaces/HeatMap.interface' | ||
import { IHeatMap } from '../../../src/interfaces/HeatMap.interface'; | ||
|
||
describe('HeatMap model', () => { | ||
describe('heatMap validation', () => { | ||
let heatMap: IHeatMap; | ||
beforeEach(() => { | ||
heatMap = { | ||
date: "2022-02-01", | ||
thr_messages: [0, 1, 1, 1, 2, 0, 0, 1, 1, 0, 1, 0, 2, 0, 4, 3, 1, 2, 0, 1, 0, 1, 0, 2], | ||
lone_messages: [0, 1, 1, 1, 2, 0, 0, 1, 1, 0, 1, 0, 2, 0, 4, 3, 1, 2, 0, 1, 0, 1, 0, 2], | ||
replier: [0, 1, 1, 1, 2, 0, 0, 1, 1, 0, 1, 0, 2, 0, 4, 3, 1, 2, 0, 1, 0, 1, 0, 2], | ||
replied_per_acc: [{account: "Magic", count: 4}], | ||
replied: [0, 1, 1, 1, 2, 0, 0, 1, 1, 0, 1, 0, 2, 0, 4, 3, 1, 2, 0, 1, 0, 1, 0, 2], | ||
mentioner: [0, 1, 1, 1, 2, 0, 0, 1, 1, 0, 1, 0, 2, 0, 4, 3, 1, 2, 0, 1, 0, 1, 0, 2], | ||
mentioner_per_acc: [{account: "Behzad", count: 4}, {account: "Magic", count: 2}], | ||
mentioned: [0, 1, 1, 1, 2, 0, 0, 1, 1, 0, 1, 0, 2, 0, 4, 3, 1, 2, 0, 1, 0, 1, 0, 2], | ||
reacter: [0, 1, 1, 1, 2, 0, 0, 1, 1, 0, 1, 0, 2, 0, 4, 3, 1, 2, 0, 1, 0, 1, 0, 2], | ||
reacted_per_acc: [{account: "End", count: 2}, {account: "Magic", count: 2}], | ||
reacted: [0, 1, 1, 1, 2, 0, 0, 1, 1, 0, 1, 0, 2, 0, 4, 3, 1, 2, 0, 1, 0, 1, 0, 2], | ||
channelId: "123123123123", | ||
account_name: "MagicPalm" | ||
} | ||
}); | ||
|
||
test('should correctly validate a valid heatMap', async () => { | ||
await expect(new HeatMap(heatMap).validate()).resolves.toBeUndefined(); | ||
}); | ||
describe('heatMap validation', () => { | ||
let heatMap: IHeatMap; | ||
beforeEach(() => { | ||
heatMap = { | ||
date: '2022-02-01', | ||
thr_messages: [0, 1, 1, 1, 2, 0, 0, 1, 1, 0, 1, 0, 2, 0, 4, 3, 1, 2, 0, 1, 0, 1, 0, 2], | ||
lone_messages: [0, 1, 1, 1, 2, 0, 0, 1, 1, 0, 1, 0, 2, 0, 4, 3, 1, 2, 0, 1, 0, 1, 0, 2], | ||
replier: [0, 1, 1, 1, 2, 0, 0, 1, 1, 0, 1, 0, 2, 0, 4, 3, 1, 2, 0, 1, 0, 1, 0, 2], | ||
replied_per_acc: [{ account: 'Magic', count: 4 }], | ||
replied: [0, 1, 1, 1, 2, 0, 0, 1, 1, 0, 1, 0, 2, 0, 4, 3, 1, 2, 0, 1, 0, 1, 0, 2], | ||
mentioner: [0, 1, 1, 1, 2, 0, 0, 1, 1, 0, 1, 0, 2, 0, 4, 3, 1, 2, 0, 1, 0, 1, 0, 2], | ||
mentioner_per_acc: [ | ||
{ account: 'Behzad', count: 4 }, | ||
{ account: 'Magic', count: 2 }, | ||
], | ||
mentioned: [0, 1, 1, 1, 2, 0, 0, 1, 1, 0, 1, 0, 2, 0, 4, 3, 1, 2, 0, 1, 0, 1, 0, 2], | ||
reacter: [0, 1, 1, 1, 2, 0, 0, 1, 1, 0, 1, 0, 2, 0, 4, 3, 1, 2, 0, 1, 0, 1, 0, 2], | ||
reacted_per_acc: [ | ||
{ account: 'End', count: 2 }, | ||
{ account: 'Magic', count: 2 }, | ||
], | ||
reacted: [0, 1, 1, 1, 2, 0, 0, 1, 1, 0, 1, 0, 2, 0, 4, 3, 1, 2, 0, 1, 0, 1, 0, 2], | ||
channelId: '123123123123', | ||
account_name: 'MagicPalm', | ||
}; | ||
}); | ||
|
||
test('should correctly validate a valid heatMap', async () => { | ||
await expect(new HeatMap(heatMap).validate()).resolves.toBeUndefined(); | ||
}); | ||
}); | ||
}); | ||
}); |
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,27 +1,26 @@ | ||
import { Token } from '../../../src/models'; | ||
import { IToken } from '../../../src/interfaces/Token.interface' | ||
import moment from "moment"; | ||
import { IToken } from '../../../src/interfaces/Token.interface'; | ||
import moment from 'moment'; | ||
|
||
describe('Token model', () => { | ||
describe('Token validation', () => { | ||
let token: IToken; | ||
beforeEach(() => { | ||
token = { | ||
user: "681946187490000906", | ||
token: "716384", | ||
type: "access", | ||
expires: moment("2022-02-01 08:30:26.127Z").toDate() | ||
}; | ||
}); | ||
|
||
test('should correctly validate a valid token', async () => { | ||
await expect(new Token(token).validate()).resolves.toBeUndefined(); | ||
}); | ||
describe('Token validation', () => { | ||
let token: IToken; | ||
beforeEach(() => { | ||
token = { | ||
user: '1234', | ||
token: '4321', | ||
type: 'access', | ||
expires: moment('2022-02-01 08:30:26.127Z').toDate(), | ||
}; | ||
}); | ||
|
||
test('should throw a validation error if type is invalid', async () => { | ||
token.type = 'invalidToken'; | ||
await expect(new Token(token).validate()).rejects.toThrow(); | ||
}); | ||
test('should correctly validate a valid token', async () => { | ||
await expect(new Token(token).validate()).resolves.toBeUndefined(); | ||
}); | ||
|
||
test('should throw a validation error if type is invalid', async () => { | ||
token.type = 'invalidToken'; | ||
await expect(new Token(token).validate()).rejects.toThrow(); | ||
}); | ||
}); | ||
}); | ||
}); |
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,22 +1,22 @@ | ||
import { User } from '../../../src/models'; | ||
import { IUser } from '../../../src/interfaces/User.interface' | ||
import { IUser } from '../../../src/interfaces/User.interface'; | ||
|
||
describe('User model', () => { | ||
describe('User validation', () => { | ||
let user: IUser; | ||
beforeEach(() => { | ||
user = { | ||
discordId: "681946187490000906", | ||
}; | ||
}); | ||
describe('User validation', () => { | ||
let user: IUser; | ||
beforeEach(() => { | ||
user = { | ||
discordId: '1234', | ||
}; | ||
}); | ||
|
||
test('should correctly validate a valid user', async () => { | ||
await expect(new User(user).validate()).resolves.toBeUndefined(); | ||
}); | ||
test('should correctly validate a valid user', async () => { | ||
await expect(new User(user).validate()).resolves.toBeUndefined(); | ||
}); | ||
|
||
test('should throw a validation error if email is invalid', async () => { | ||
user.email = 'invalidEmail'; | ||
await expect(new User(user).validate()).rejects.toThrow(); | ||
}); | ||
test('should throw a validation error if email is invalid', async () => { | ||
user.email = 'invalidEmail'; | ||
await expect(new User(user).validate()).rejects.toThrow(); | ||
}); | ||
}); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/** @type {import('ts-jest').JestConfigWithTsJest} */ | ||
module.exports = { | ||
preset: "ts-jest", | ||
testEnvironment: "node", | ||
}; | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
}; |
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 |
---|---|---|
|
@@ -55,4 +55,4 @@ | |
"files": [ | ||
"lib/**/*" | ||
] | ||
} | ||
} |
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.