Skip to content

Commit

Permalink
Merge pull request #550 from COS301-SE-2023/dev/readme_update
Browse files Browse the repository at this point in the history
Dev/readme update -> codecov
  • Loading branch information
JanSpies82 authored Oct 24, 2023
2 parents 8189451 + 9c3c158 commit 20c5e28
Show file tree
Hide file tree
Showing 19 changed files with 181 additions and 276 deletions.
168 changes: 87 additions & 81 deletions README.md

Large diffs are not rendered by default.

19 changes: 13 additions & 6 deletions backend/.env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# AWS RDS MariaDB
DB_TYPE=mariadb
DB_TYPE=<REPLACE-ME>
DB_HOST=<REPLACE-ME>
DB_PORT=<REPLACE-ME>
DB_USERNAME=<REPLACE-ME>
Expand All @@ -14,26 +14,33 @@ TEST_SALT=<REPLACE-ME>
TEST_USERID=<REPLACE-ME>
DB_TEST_PASSWORD=<REPLACE-ME>

# Authentification
# Authentication
PEPPER=<REPLACE-ME>
JWT_SECRET_KEY=<REPLACE-ME>
AUTH_BEARER=<REPLACE-ME>
GOOGLE_CLIENT_ID=<REPLACE-ME>

# AWS S3
AWS_S3_ACCESS_KEY_ID=<REPLACE-ME>
AWS_S3_SECRET_ACCESS_KEY=<REPLACE-ME>

# AWS Textract
AWS_S3_BUCKET_NAME=<REPLACE-ME>
AWS_S3_BUCKET_REGION=<REPLACE-ME>

# AWS Textract
AWS_S3_TEXTRACT_QUEUE_URL=<REPLACE-ME>
AWS_S3_TEXTRACT_ROLE_ARN=<REPLACE-ME>
AWS_TEXTRACT_SNS_TOPIC_ARN=<REPLACE-ME>

# Email service
SYSTEM_EMAIL=<REPLACE-ME>
SYSTEM_EMAIL_PASSWORD=<REPLACE-ME>
SYSTEM_MAIL_SERVER_PASSWORD=<REPLACE-ME>

# Environment variables
FRONTEND_URL=<REPLACE-ME>
FRONTEND_URL=<REPLACE-ME>
PRIVATE_KEY=<REPLACE-ME>
PUBLIC_KEY=<REPLACE-ME>

# Version control
MAX_DIFFS=<REPLACE-ME>
MAX_SNAPSHOTS=<REPLACE-ME>
DIFFS_PER_SNAPSHOT=<REPLACE-ME>
80 changes: 79 additions & 1 deletion backend/src/auth/auth.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import { AuthService } from './auth.service';
import { AuthController } from './auth.controller';
import { AuthModule } from './auth.module';
import { RefreshTokenDTO } from './dto/refresh_token.dto';
import { SignatureDTO } from './dto/signature.dto';
import {
HttpException,
HttpStatus,
} from '@nestjs/common';
import e from 'express';

describe('AuthController', () => {
let controller: AuthController;
Expand Down Expand Up @@ -131,4 +131,82 @@ describe('AuthController', () => {
).toBeCalledWith(refreshTokenDTO);
});
});

describe('sign_checksum', () => {
it('should throw exception if request method is not POST', async () => {
const request = { method: 'GET' };
const signatureDTO = new SignatureDTO();

try {
await controller.signChecksum(
signatureDTO,
request as any,
);
expect(true).toBe(false);
} catch (error) {
expect(error).toBeInstanceOf(
HttpException,
);
expect(error.message).toBe(
'Method Not Allowed',
);
expect(error.status).toBe(
HttpStatus.METHOD_NOT_ALLOWED,
);
}
});

it('should throw an exception if Checksum is undefined', async () => {
const signatureDTO = new SignatureDTO();
signatureDTO.UserID = 1;
signatureDTO.MarkdownID = 'test';

const request = { method: 'POST' };

try {
await controller.signChecksum(
signatureDTO,
request as any,
);
expect(true).toBe(false);
} catch (error) {
expect(error).toBeInstanceOf(
HttpException,
);
expect(error.message).toBe(
'Invalid request body',
);
expect(error.status).toBe(
HttpStatus.BAD_REQUEST,
);
}
});

it('should return a signed checksum', async () => {
const signatureDTO = new SignatureDTO();
signatureDTO.UserID = 1;
signatureDTO.Checksum = 'test';
signatureDTO.MarkdownID = 'test';

const request = { method: 'POST' };

(
jest.spyOn(
authService,
'signChecksum',
) as any
).mockResolvedValue(new SignatureDTO());

const result =
await controller.signChecksum(
signatureDTO,
request as any,
);

expect(result).toBeInstanceOf(SignatureDTO);
expect(
authService.signChecksum,
).toBeCalledWith(signatureDTO);
});
});
});
8 changes: 0 additions & 8 deletions frontend/src/app/click-at-coordinate.directive.spec.ts

This file was deleted.

2 changes: 1 addition & 1 deletion frontend/src/app/click-at-coordinate.directive.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Directive, HostListener, ElementRef } from '@angular/core';
import { CoordinateService } from './services/coordinate-service.service';
import { CoordinateService } from './services/coordinate.service';

@Directive({
selector: '[appClickAtCoordinate]',
Expand Down
1 change: 0 additions & 1 deletion frontend/src/app/edit/interfaces/index.ts

This file was deleted.

3 changes: 0 additions & 3 deletions frontend/src/app/edit/interfaces/test.interface.ts

This file was deleted.

2 changes: 1 addition & 1 deletion frontend/src/app/home/home.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { UserService } from '../services/user.service';
import { FileUploadPopupComponent } from '../file-upload-popup/file-upload-popup.component';
import { EditService } from '../services/edit.service';
import { FolderService } from '../services/folder.service';
import { CoordinateService } from '../services/coordinate-service.service';
import { CoordinateService } from '../services/coordinate.service';
import { ImageUploadPopupComponent } from '../image-upload-popup/image-upload-popup.component';
import { NgxSpinnerService } from 'ngx-spinner';
import { ContextMenu } from 'primeng/contextmenu';
Expand Down
19 changes: 0 additions & 19 deletions frontend/src/app/services/asset.service.spec.ts

This file was deleted.

19 changes: 0 additions & 19 deletions frontend/src/app/services/conversion.service.spec.ts

This file was deleted.

19 changes: 0 additions & 19 deletions frontend/src/app/services/coordinate-service.service.spec.ts

This file was deleted.

19 changes: 0 additions & 19 deletions frontend/src/app/services/edit.service.spec.ts

This file was deleted.

19 changes: 0 additions & 19 deletions frontend/src/app/services/file.service.spec.ts

This file was deleted.

19 changes: 0 additions & 19 deletions frontend/src/app/services/folder.service.spec.ts

This file was deleted.

19 changes: 0 additions & 19 deletions frontend/src/app/services/home.service.spec.ts

This file was deleted.

23 changes: 0 additions & 23 deletions frontend/src/app/services/user.service.spec.ts

This file was deleted.

16 changes: 0 additions & 16 deletions frontend/src/app/services/versioning-api.service.spec.ts

This file was deleted.

2 changes: 0 additions & 2 deletions frontend/src/environments/environment.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
export const environment = {
production: false,
frontendURL: 'http://localhost:4200/',
clientId: 'secret',
apiURL: 'http://localhost:3000/',
DEV_USER_EMAIL: 'secret',
DEV_USER_PASSWORD: 'secret',
frontendSignature: 'secret',
PUBLIC_KEY: 'secret',
};

0 comments on commit 20c5e28

Please sign in to comment.