Skip to content

Commit 41753fb

Browse files
committed
style: lint project
1 parent f3cd77a commit 41753fb

File tree

11 files changed

+20
-17
lines changed

11 files changed

+20
-17
lines changed

server/src/auth/auth.service.spec.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
11
import { JwtService } from '@nestjs/jwt';
22
import { Test, TestingModule } from '@nestjs/testing';
3-
import axios from 'axios';
3+
import { beforeEach, describe, expect, it, jest, mock, spyOn } from 'bun:test';
44
import type { Request, Response } from 'express';
55

66
import type { UserDocument } from '@server/user/entity/user.entity';
77
import { UserService } from '@server/user/user.service';
88

99
import { AuthService } from './auth.service';
10-
import { DiscordUser } from './types/discordProfile';
11-
import { GithubAccessToken } from './types/githubProfile';
12-
import { GoogleProfile } from './types/googleProfile';
1310
import { Profile } from './types/profile';
14-
import { mock, jest, describe, beforeEach, it, expect, spyOn } from 'bun:test';
11+
1512
const mockAxios = {
1613
get: jest.fn(),
1714
post: jest.fn(),
1815
put: jest.fn(),
1916
delete: jest.fn(),
2017
create: jest.fn(),
2118
};
19+
2220
mock.module('axios', () => mockAxios);
2321

2422
const mockUserService = {

server/src/file/file.service.spec.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
import {
2-
GetObjectCommand,
3-
HeadBucketCommand,
4-
PutObjectCommand,
5-
S3Client,
6-
} from '@aws-sdk/client-s3';
1+
import { S3Client } from '@aws-sdk/client-s3';
72
import { getSignedUrl } from '@aws-sdk/s3-request-presigner';
83
import { Test, TestingModule } from '@nestjs/testing';
4+
import { beforeEach, describe, expect, it, jest, mock } from 'bun:test';
95

106
import { FileService } from './file.service';
11-
import { mock, jest, describe, beforeEach, it, expect, spyOn } from 'bun:test';
7+
128
mock.module('@aws-sdk/client-s3', () => {
139
const mS3Client = {
1410
send: jest.fn(),
@@ -194,6 +190,7 @@ describe('FileService', () => {
194190
const arrayBufferResult = result.slice(0, result.byteLength);
195191

196192
expect(arrayBufferResult).toBeInstanceOf(ArrayBuffer);
193+
197194
expect(new Uint8Array(arrayBufferResult)).toEqual(
198195
new Uint8Array([1, 2, 3]),
199196
);

server/src/file/file.service.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,11 @@ export class FileService {
244244

245245
const arrayBuffer = new ArrayBuffer(byteArray.length);
246246
const view = new Uint8Array(arrayBuffer);
247+
247248
for (let i = 0; i < byteArray.length; i++) {
248249
view[i] = byteArray[i];
249250
}
251+
250252
return arrayBuffer;
251253
} catch (error) {
252254
this.logger.error('Error getting file: ', error);

server/src/lib/GetRequestUser.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { ExecutionContext, HttpException, HttpStatus } from '@nestjs/common';
2-
import { GetRequestToken, validateUser } from './GetRequestUser';
2+
33
import type { UserDocument } from '@server/user/entity/user.entity';
44

5+
import { GetRequestToken, validateUser } from './GetRequestUser';
56

67
describe('GetRequestToken', () => {
78
it('should be a defined decorator', () => {

server/src/lib/initializeSwagger.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { INestApplication } from '@nestjs/common';
22
import { SwaggerModule } from '@nestjs/swagger';
3+
import { beforeEach, describe, expect, it, jest, mock } from 'bun:test';
34

45
import { initializeSwagger } from './initializeSwagger';
5-
import { mock, jest, describe, beforeEach, it, expect, spyOn } from 'bun:test';
66

77
mock.module('@nestjs/swagger', () => ({
88
DocumentBuilder: jest.fn().mockImplementation(() => ({

server/src/lib/parseToken.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { ExecutionContext } from '@nestjs/common';
22
import { Test, TestingModule } from '@nestjs/testing';
3+
34
import { AuthService } from '@server/auth/auth.service';
45

56
import { ParseTokenPipe } from './parseToken';

server/src/lib/parseToken.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
Injectable,
66
Logger,
77
} from '@nestjs/common';
8+
89
import { AuthService } from '@server/auth/auth.service';
910

1011
@Injectable()

server/src/song/my-songs/my-songs.controller.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { HttpException } from '@nestjs/common';
22
import { AuthGuard } from '@nestjs/passport';
33
import { Test, TestingModule } from '@nestjs/testing';
4-
import type { UserDocument } from '@server/user/entity/user.entity';
54
import { PageQueryDTO } from '@shared/validation/common/dto/PageQuery.dto';
65
import { SongPageDto } from '@shared/validation/song/dto/SongPageDto';
76

7+
import type { UserDocument } from '@server/user/entity/user.entity';
8+
89
import { SongService } from '../song.service';
910
import { MySongsController } from './my-songs.controller';
1011

@@ -61,6 +62,7 @@ describe('MySongsController', () => {
6162
it('should handle thrown an exception if userDocument is null', async () => {
6263
const query: PageQueryDTO = { page: 1, limit: 10 };
6364
const user = null;
65+
6466
await expect(controller.getMySongsPage(query, user)).rejects.toThrow(
6567
HttpException,
6668
);

server/src/song/song-upload/song-upload.service.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { HttpException } from '@nestjs/common';
33
import { Test, TestingModule } from '@nestjs/testing';
44
import { ThumbnailData } from '@shared/validation/song/dto/ThumbnailData.dto';
55
import { UploadSongDto } from '@shared/validation/song/dto/UploadSongDto.dto';
6+
import { beforeEach, describe, expect, it, jest, mock, spyOn } from 'bun:test';
67
import { Types } from 'mongoose';
78

89
import { FileService } from '@server/file/file.service';
@@ -11,7 +12,6 @@ import { UserService } from '@server/user/user.service';
1112

1213
import { SongUploadService } from './song-upload.service';
1314
import { SongDocument, Song as SongEntity } from '../entity/song.entity';
14-
import { mock, jest, describe, beforeEach, it, expect, spyOn } from 'bun:test';
1515

1616
// mock drawToImage function
1717
mock.module('@shared/features/thumbnail', () => ({

server/src/song/song-webhook/song-webhook.service.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { ConfigModule, ConfigService } from '@nestjs/config';
22
import { getModelToken } from '@nestjs/mongoose';
33
import { Test, TestingModule } from '@nestjs/testing';
4+
import { beforeEach, describe, expect, it, jest, mock, spyOn } from 'bun:test';
45
import { Model } from 'mongoose';
56

67
import { SongWebhookService } from './song-webhook.service';
78
import { Song as SongEntity, SongWithUser } from '../entity/song.entity';
89
import { getUploadDiscordEmbed } from '../song.util';
9-
import { mock, jest, describe, beforeEach, it, expect, spyOn } from 'bun:test';
1010

1111
mock.module('../song.util', () => ({
1212
getUploadDiscordEmbed: jest.fn(),

0 commit comments

Comments
 (0)