-
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.
Merge pull request #104 from AII-the-time/feat/docker-cicd-for-arm
Feat:docker ci/cd for arm
- Loading branch information
Showing
6 changed files
with
453 additions
and
4 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
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 |
---|---|---|
@@ -0,0 +1,108 @@ | ||
import { FastifyInstance } from 'fastify'; | ||
import { ErrorInterface } from '@DTO/index.dto'; | ||
import testValues from '../testValues'; | ||
import * as Menu from '@DTO/menu.dto'; | ||
import * as Order from '@DTO/order.dto'; | ||
import { expect, test } from '@jest/globals'; | ||
|
||
export default (app: FastifyInstance) => () => { | ||
let tempOrderId: number; | ||
test('order without mileage', async () => { | ||
const response = await app.inject({ | ||
method: 'POST', | ||
url: `/api/order`, | ||
headers: testValues.storeHeader, | ||
payload: { | ||
menus: [ | ||
{ | ||
id: testValues.americanoId, | ||
count: 1, | ||
options: [1], | ||
}, | ||
], | ||
totalPrice: (2500).toString(), | ||
}, | ||
}); | ||
expect(response.statusCode).toBe(200); | ||
const body = JSON.parse(response.body) as Order.newOrderInterface['Reply']['200']; | ||
expect(body.orderId).toBeDefined(); | ||
tempOrderId = body.orderId; | ||
}); | ||
|
||
test('pay without mileage', async () => { | ||
const response = await app.inject({ | ||
method: 'POST', | ||
url: `/api/order/pay`, | ||
headers: testValues.storeHeader, | ||
payload: { | ||
orderId: tempOrderId, | ||
paymentMethod: 'CARD', | ||
} as Order.payInterface['Body'], | ||
}); | ||
expect(response.statusCode).toBe(200); | ||
}); | ||
|
||
let tempMenuId: number; | ||
test('register menu without option, recipe', async () => { | ||
const response = await app.inject({ | ||
method: 'POST', | ||
url: `/api/menu`, | ||
headers: testValues.storeHeader, | ||
payload: { | ||
name: 'new menu', | ||
price: "1000", | ||
categoryId: testValues.coffeeCategoryId, | ||
} as Menu.createMenuInterface['Body'], | ||
}); | ||
expect(response.statusCode).toBe(201); | ||
const body = JSON.parse(response.body) as Menu.createMenuInterface['Reply']['201']; | ||
expect(body.menuId).toBeDefined(); | ||
tempMenuId = body.menuId; | ||
}); | ||
|
||
test('update menu without option, recipe', async () => { | ||
const response = await app.inject({ | ||
method: 'PUT', | ||
url: `/api/menu`, | ||
headers: testValues.storeHeader, | ||
payload: { | ||
id: tempMenuId, | ||
name: 'new menu', | ||
price: "1000", | ||
categoryId: testValues.coffeeCategoryId, | ||
} as Menu.updateMenuInterface['Body'] | ||
}); | ||
expect(response.statusCode).toBe(201); | ||
const body = JSON.parse(response.body) as Menu.updateMenuInterface['Reply']['201']; | ||
expect(body.menuId).not.toBe(tempMenuId); | ||
}); | ||
|
||
test('update menu with recipe with unit', async () => { | ||
const response = await app.inject({ | ||
method: 'PUT', | ||
url: `/api/menu`, | ||
headers: testValues.storeHeader, | ||
payload: { | ||
id: tempMenuId, | ||
name: 'new menu', | ||
price: "1000", | ||
categoryId: testValues.coffeeCategoryId, | ||
recipe: [ | ||
{ | ||
id: testValues.coffeeBeanId, | ||
unit: 'g', | ||
isMixed: false, | ||
}, | ||
{ | ||
id: testValues.preservedLemonId, | ||
unit: 'g', | ||
isMixed: true, | ||
} | ||
], | ||
} as Menu.updateMenuInterface['Body'] | ||
}); | ||
expect(response.statusCode).toBe(201); | ||
const body = JSON.parse(response.body) as Menu.updateMenuInterface['Reply']['201']; | ||
expect(body.menuId).not.toBe(tempMenuId); | ||
}); | ||
}; |
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,17 @@ | ||
import { FastifyInstance } from 'fastify'; | ||
import { afterAll, describe} from '@jest/globals'; | ||
import createWithoutParams from './createWithoutParams'; | ||
import report from './report'; | ||
import stockHistory from './stockHistory'; | ||
|
||
const tests:[string, (app: FastifyInstance) => () => void][] = [ | ||
['create without params', createWithoutParams], | ||
['report', report], | ||
['stock history', stockHistory], | ||
]; | ||
|
||
export default (app: FastifyInstance) => () => { | ||
tests.forEach(([name, test]) => { | ||
describe(name, test(app)); | ||
}); | ||
}; |
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,54 @@ | ||
import { FastifyInstance } from 'fastify'; | ||
import { ErrorInterface } from '@DTO/index.dto'; | ||
import * as Report from '@DTO/report.dto'; | ||
import testValues from '../testValues'; | ||
import { PrismaClient } from '@prisma/client'; | ||
import { expect, test, beforeAll } from '@jest/globals'; | ||
|
||
const prisma = new PrismaClient(); | ||
|
||
export default (app: FastifyInstance) => () => { | ||
test('get report', async () => { | ||
const response = await app.inject({ | ||
method: 'GET', | ||
url: `/api/report`, | ||
headers: testValues.testStoreHeader, | ||
}); | ||
expect(response.statusCode).toBe(200); | ||
const body = JSON.parse(response.body) as Report.reportInterface['Reply']['200']; | ||
const recentSalesReport = body.responseData.viewContents[0].content as unknown as Report.graphInterface; | ||
expect(recentSalesReport.graphTitle).toBe('최근 30일 매출'); | ||
expect(recentSalesReport.graphColor).toBe('#2B1E12'); | ||
expect(recentSalesReport.graphItems.length).toBeGreaterThan(0); | ||
|
||
const salesReportByTime = body.responseData.viewContents[1].content as unknown as Report.graphInterface; | ||
expect(salesReportByTime.graphTitle).toBe('최근 30일 시간대별 매출'); | ||
expect(salesReportByTime.graphColor).toBe('#2B1E12'); | ||
expect(salesReportByTime.graphItems.length).toBeGreaterThan(0); | ||
|
||
const returnRateReport = body.responseData.viewContents[2].content as unknown as Report.pieChartInterface; | ||
expect(returnRateReport.pieChartTitle).toBe('재방문율'); | ||
expect(returnRateReport.totalCount).toBe(250); | ||
expect(returnRateReport.pieChartItems.length).toBe(6); | ||
|
||
const reservedSalesReport = body.responseData.viewContents[3].content as unknown as Report.pieChartInterface; | ||
expect(reservedSalesReport.pieChartTitle).toBe('예약 매출'); | ||
expect(reservedSalesReport.pieChartItems.length).toBe(2); | ||
}); | ||
|
||
test('get report', async () => { | ||
const response = await app.inject({ | ||
method: 'GET', | ||
url: `/api/report`, | ||
headers: testValues.storeHeader, | ||
}); | ||
expect(response.statusCode).toBe(200); | ||
const body = JSON.parse(response.body) as Report.reportInterface['Reply']['200']; | ||
expect(body.responseData.viewContents.length).toBe(1); | ||
const textReport = body.responseData.viewContents[0].content as unknown as Report.textInterface; | ||
expect(body.responseData.viewContents[0].viewType).toBe('TEXT'); | ||
expect(textReport).toHaveProperty('textItems'); | ||
expect(textReport.textItems.length).toBe(1); | ||
expect(textReport.textItems[0].text).toBe('최소 3일 이상의 주문 데이터가 필요합니다.'); | ||
}); | ||
}; |
Oops, something went wrong.