-
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.
- Loading branch information
1 parent
6b6ff2f
commit 4090141
Showing
26 changed files
with
4,385 additions
and
3,174 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,8 @@ | ||
config = require('eslint-config-service-soft'); | ||
|
||
module.exports = [ | ||
...config, | ||
{ | ||
ignores: ['showcase'] | ||
} | ||
]; |
Large diffs are not rendered by default.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
/** | ||
* Sleeps for the given amount of milliseconds. | ||
* You need to await this to work. | ||
* | ||
* @param ms - The amount of milliseconds everything should sleep. | ||
* @returns When the time has passed. | ||
*/ | ||
export async function sleep(ms: number): Promise<void> { | ||
return new Promise( resolve => setTimeout(resolve, ms) ); | ||
return new Promise(resolve => setTimeout(resolve, ms) ); | ||
} |
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 |
---|---|---|
|
@@ -5,23 +5,23 @@ import { BaseUser, PasswordResetToken } from '../../models'; | |
import { BaseMailService } from '../../services'; | ||
import { DefaultEntityOmitKeys } from '../../types'; | ||
|
||
// eslint-disable-next-line jsdoc/require-jsdoc | ||
|
||
class MailService extends BaseMailService<string> { | ||
// eslint-disable-next-line jsdoc/require-jsdoc | ||
|
||
protected readonly WEBSERVER_MAIL: string = '[email protected]'; | ||
// eslint-disable-next-line jsdoc/require-jsdoc | ||
|
||
protected readonly BASE_RESET_PASSWORD_LINK: string = 'http://localhost:4200/reset-password'; | ||
// eslint-disable-next-line jsdoc/require-jsdoc | ||
|
||
protected readonly webserverMailTransporter: Transporter; | ||
// eslint-disable-next-line jsdoc/require-jsdoc | ||
|
||
protected readonly PRODUCTION: boolean = false; | ||
// eslint-disable-next-line jsdoc/require-jsdoc | ||
|
||
protected readonly SAVED_EMAILS_PATH: string = './test-emails'; | ||
// eslint-disable-next-line jsdoc/require-jsdoc | ||
|
||
protected override readonly LOGO_HEADER_URL: string = 'https://via.placeholder.com/165x165'; | ||
// eslint-disable-next-line jsdoc/require-jsdoc | ||
|
||
protected override readonly LOGO_FOOTER_URL?: string = 'https://via.placeholder.com/500x60'; | ||
// eslint-disable-next-line jsdoc/require-jsdoc | ||
|
||
protected readonly ADDRESS_LINES: string[] = ['my address', 'my name']; | ||
} | ||
|
||
|
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 |
---|---|---|
|
@@ -11,7 +11,7 @@ import { BaseUserRepository, CredentialsRepository, PasswordResetTokenRepository | |
import { BaseMailService, BaseUserService } from '../../services'; | ||
import { DefaultEntityOmitKeys } from '../../types'; | ||
|
||
// eslint-disable-next-line jsdoc/require-jsdoc | ||
|
||
enum Roles { | ||
USER = 'user', | ||
ADMIN = 'admin' | ||
|
@@ -28,33 +28,33 @@ const transaction: juggler.Transaction = { | |
}; | ||
testDb.stubs.beginTransaction.resolves(transaction); | ||
|
||
// eslint-disable-next-line jsdoc/require-jsdoc | ||
|
||
class MailService extends BaseMailService<string> { | ||
// eslint-disable-next-line jsdoc/require-jsdoc | ||
|
||
protected readonly WEBSERVER_MAIL: string = '[email protected]'; | ||
// eslint-disable-next-line jsdoc/require-jsdoc | ||
|
||
protected readonly BASE_RESET_PASSWORD_LINK: string = 'http://localhost:4200/reset-password'; | ||
// eslint-disable-next-line jsdoc/require-jsdoc | ||
|
||
protected readonly webserverMailTransporter: Transporter; | ||
// eslint-disable-next-line jsdoc/require-jsdoc | ||
|
||
protected readonly PRODUCTION: boolean = false; | ||
// eslint-disable-next-line jsdoc/require-jsdoc | ||
|
||
protected readonly SAVED_EMAILS_PATH: string = './test-emails'; | ||
// eslint-disable-next-line jsdoc/require-jsdoc | ||
|
||
protected override readonly LOGO_HEADER_URL: string = 'https://via.placeholder.com/165x165'; | ||
// eslint-disable-next-line jsdoc/require-jsdoc | ||
|
||
protected override readonly LOGO_FOOTER_URL: string = 'https://via.placeholder.com/500x60'; | ||
// eslint-disable-next-line jsdoc/require-jsdoc | ||
|
||
protected readonly ADDRESS_LINES: string[] = ['my address', 'my name']; | ||
} | ||
|
||
// eslint-disable-next-line max-len | ||
|
||
const baseUserRepository: StubbedInstanceWithSinonAccessor<BaseUserRepository<Roles>> = createStubInstance(BaseUserRepository) as StubbedInstanceWithSinonAccessor<BaseUserRepository<Roles>>; | ||
const credentialsRepository: StubbedInstanceWithSinonAccessor<CredentialsRepository> = createStubInstance(CredentialsRepository); | ||
// eslint-disable-next-line max-len | ||
|
||
const passwordResetTokenRepository: StubbedInstanceWithSinonAccessor<PasswordResetTokenRepository<Roles>> = createStubInstance(PasswordResetTokenRepository); | ||
const mailService: MailService = new MailService(); | ||
// eslint-disable-next-line max-len | ||
|
||
const baseUserService: BaseUserService<Roles> = new BaseUserService<Roles>(baseUserRepository, passwordResetTokenRepository, 300000, testDb, mailService); | ||
|
||
describe('BaseUserService', () => { | ||
|
@@ -106,10 +106,10 @@ describe('BaseUserService', () => { | |
}); | ||
|
||
baseUserRepository.stubs.findOne.resolves(user); | ||
// eslint-disable-next-line max-len | ||
|
||
const credentialsHasOneRepository: StubbedInstanceWithSinonAccessor<HasOneRepository<Credentials>> = createStubInstance(DefaultHasOneRepository); | ||
credentialsHasOneRepository.stubs.get.resolves(credentials); | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
// eslint-disable-next-line typescript/no-unused-vars | ||
(baseUserRepository.stubs.credentials as unknown) = (id: string) => credentialsHasOneRepository; | ||
const userFromVerifiedCredentials: BaseUser<Roles> = await baseUserService.verifyCredentials({ | ||
email: '[email protected]', | ||
|
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 |
---|---|---|
|
@@ -8,29 +8,29 @@ import { AccessTokenService, BaseMailService, BaseUserService, RefreshTokenServi | |
import { DefaultEntityOmitKeys, TokenObject } from '../../types'; | ||
import { sleep } from '../fixtures/helpers'; | ||
|
||
// eslint-disable-next-line jsdoc/require-jsdoc | ||
|
||
enum Roles { | ||
USER = 'user', | ||
ADMIN = 'admin' | ||
} | ||
|
||
// eslint-disable-next-line jsdoc/require-jsdoc | ||
|
||
class MailService extends BaseMailService<Roles> { | ||
// eslint-disable-next-line jsdoc/require-jsdoc | ||
|
||
protected readonly WEBSERVER_MAIL: string = '[email protected]'; | ||
// eslint-disable-next-line jsdoc/require-jsdoc | ||
|
||
protected readonly BASE_RESET_PASSWORD_LINK: string = 'http://localhost:4200/reset-password'; | ||
// eslint-disable-next-line jsdoc/require-jsdoc | ||
|
||
protected readonly webserverMailTransporter: Transporter; | ||
// eslint-disable-next-line jsdoc/require-jsdoc | ||
|
||
protected readonly PRODUCTION: boolean = false; | ||
// eslint-disable-next-line jsdoc/require-jsdoc | ||
|
||
protected readonly SAVED_EMAILS_PATH: string = './test-emails'; | ||
// eslint-disable-next-line jsdoc/require-jsdoc | ||
|
||
protected override readonly LOGO_HEADER_URL: string = 'https://via.placeholder.com/165x165'; | ||
// eslint-disable-next-line jsdoc/require-jsdoc | ||
|
||
protected override readonly LOGO_FOOTER_URL: string = 'https://via.placeholder.com/500x60'; | ||
// eslint-disable-next-line jsdoc/require-jsdoc | ||
|
||
protected readonly ADDRESS_LINES: string[] = ['my address', 'my name']; | ||
} | ||
|
||
|
@@ -45,13 +45,13 @@ const transaction: juggler.Transaction = { | |
}; | ||
testDb.stubs.beginTransaction.resolves(transaction); | ||
|
||
// eslint-disable-next-line max-len | ||
|
||
const baseUserRepository: StubbedInstanceWithSinonAccessor<BaseUserRepository<Roles>> = createStubInstance(BaseUserRepository) as StubbedInstanceWithSinonAccessor<BaseUserRepository<Roles>>; | ||
// eslint-disable-next-line max-len | ||
|
||
const passwordResetTokenRepository: StubbedInstanceWithSinonAccessor<PasswordResetTokenRepository<Roles>> = createStubInstance(PasswordResetTokenRepository); | ||
const refreshTokenRepository: StubbedInstanceWithSinonAccessor<RefreshTokenRepository> = createStubInstance(RefreshTokenRepository); | ||
const mailService: MailService = new MailService(); | ||
// eslint-disable-next-line max-len | ||
|
||
const userService: BaseUserService<Roles> = new BaseUserService<Roles>(baseUserRepository, passwordResetTokenRepository, 300000, testDb, mailService); | ||
const accessTokenService: AccessTokenService<Roles> = new AccessTokenService('accessSecret', 3600000); | ||
|
||
|
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.