Skip to content

Commit

Permalink
[TRELLO-2429] Format
Browse files Browse the repository at this point in the history
  • Loading branch information
charlescd committed Aug 1, 2024
1 parent 9364d05 commit 360517f
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 43 deletions.
72 changes: 36 additions & 36 deletions mobile-tools/src/app.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,44 @@ import request from 'supertest'
import {app} from './app'
import {Category} from './services/categories.service'

describe("Test the actus path", () => {
test("It should response the GET method", async () => {
const response = await request(app).get("/v1/actus")
expect(response.statusCode).toBe(200);
});
});
describe('Test the actus path', () => {
test('It should response the GET method', async () => {
const response = await request(app).get('/v1/actus')
expect(response.statusCode).toBe(200)
})
})

describe("Test the categories path", () => {
test("It should response the GET method", async () => {
const response = await request(app).get("/v1/categories")
expect(response.statusCode).toBe(200);
});
describe('Test the categories path', () => {
test('It should response the GET method', async () => {
const response = await request(app).get('/v1/categories')
expect(response.statusCode).toBe(200)
})

test("It should return french categories by default", async () => {
const response = await request(app).get("/v1/categories")
const categories = response.body as Category[];
test('It should return french categories by default', async () => {
const response = await request(app).get('/v1/categories')
const categories = response.body as Category[]
expect(categories).toContainEqual({
category: "AchatMagasin",
description: "Prix, promotion, qualité, poids, garantie, …",
id: "10"
});
});
test("It should return french categories", async () => {
const response = await request(app).get("/v1/categories").query({ lang: 'fr' })
const categories = response.body as Category[];
category: 'AchatMagasin',
description: 'Prix, promotion, qualité, poids, garantie, …',
id: '10',
})
})
test('It should return french categories', async () => {
const response = await request(app).get('/v1/categories').query({lang: 'fr'})
const categories = response.body as Category[]
expect(categories).toContainEqual({
category: "AchatMagasin",
description: "Prix, promotion, qualité, poids, garantie, …",
id: "10"
});
});
test("It should return english categories", async () => {
const response = await request(app).get("/v1/categories").query({ lang: 'en' })
const categories = response.body as Category[];
category: 'AchatMagasin',
description: 'Prix, promotion, qualité, poids, garantie, …',
id: '10',
})
})
test('It should return english categories', async () => {
const response = await request(app).get('/v1/categories').query({lang: 'en'})
const categories = response.body as Category[]
expect(categories).toContainEqual({
category: "AchatMagasin",
description: "Price, promotion, quality, weight, warranty, etc.",
id: "10"
});
});
});
category: 'AchatMagasin',
description: 'Price, promotion, quality, weight, warranty, etc.',
id: '10',
})
})
})
2 changes: 1 addition & 1 deletion mobile-tools/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ app.all('*', UnknownRoutesHandler)
*/
app.use(ExceptionsHandler)

export {app}
export {app}
2 changes: 1 addition & 1 deletion mobile-tools/src/controllers/categories.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ CategoriesController.get('/', async (req: Request<{}, {}, {}, QueryParams>, res,
}
})

export {CategoriesController}
export {CategoriesController}
2 changes: 1 addition & 1 deletion mobile-tools/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ const port = Config.port

app.listen(port, () => {
console.log(`[server]: Server is running at http://localhost:${port}`)
})
})
6 changes: 3 additions & 3 deletions mobile-tools/src/services/categories.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ const categoriesEn: Category[] = anomaliesEn.map((anomaly: any) => {
})

export const categories = {
'fr': categoriesFr,
'en': categoriesEn
}
fr: categoriesFr,
en: categoriesEn,
}
5 changes: 4 additions & 1 deletion mobile-tools/src/utils/exceptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ export interface ApiException {
* Ici `this.error = error` et `this.status = status`
*/
class Exception implements ApiException {
constructor(readonly error: any, readonly status: number) {}
constructor(
readonly error: any,
readonly status: number,
) {}
}

/**
Expand Down

0 comments on commit 360517f

Please sign in to comment.