Skip to content

Commit

Permalink
[Fix] #123, test cases, corrected date and filename
Browse files Browse the repository at this point in the history
  • Loading branch information
Type-Style committed Oct 8, 2024
1 parent dc01421 commit 5b06cd7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/tests/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ describe('/write', () => {

describe("GET /write", () => {
const date = new Date();
const formattedDate = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`;
const formattedDate = `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`;

const dirPath = path.resolve(__dirname, '../../dist/data/');
const filePath = path.resolve(dirPath, `data-${formattedDate}.json`);

Expand Down Expand Up @@ -274,7 +275,7 @@ describe('API calls', () => {

test(`length of json should not exceed 1000`, async () => {
const date = new Date();
const formattedDate = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`;
const formattedDate = `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`;
const dirPath = path.resolve(__dirname, '../../dist/data/');
const filePath = path.resolve(dirPath, `data-${formattedDate}.json`);
const jsonData = getData(filePath);
Expand Down

0 comments on commit 5b06cd7

Please sign in to comment.