Skip to content

Commit

Permalink
fix date in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Tenischev committed Sep 28, 2023
1 parent 6f9bdc5 commit e0bf8bd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
6 changes: 3 additions & 3 deletions tests/__snapshots__/parameters.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ import com.asyncapi.model.LightMeasuredPayload;
import javax.annotation.processing.Generated;
@Generated(value="com.asyncapi.generator.template.spring", date="2023-09-28T22:07:11.996Z")
@Generated(value="com.asyncapi.generator.template.spring", date="AnyDate")
@Service
public class MessageHandlerService {
Expand Down Expand Up @@ -188,7 +188,7 @@ import java.util.List;
import java.util.Objects;
@Generated(value="com.asyncapi.generator.template.spring", date="2023-09-28T22:07:12.056Z")
@Generated(value="com.asyncapi.generator.template.spring", date="AnyDate")
public class LightMeasuredPayload {
private @Valid Integer lumens;
Expand Down Expand Up @@ -273,7 +273,7 @@ import java.util.Objects;
import java.util.List;
@Generated(value="com.asyncapi.generator.template.spring", date="2023-09-28T22:07:12.035Z")
@Generated(value="com.asyncapi.generator.template.spring", date="AnyDate")
public class LightMeasured {
private @Valid LightMeasuredPayload payload;
Expand Down
9 changes: 6 additions & 3 deletions tests/parameters.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ describe('integration tests for generated files under different template paramet
];
for (const index in expectedFiles) {
const file = await readFile(path.join(outputDir, expectedFiles[index]), 'utf8');
expect(file).toMatchSnapshot();
const fileWithAnyDate = file.replace(/date="\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z)"/, 'date="AnyDate"');
expect(fileWithAnyDate).toMatchSnapshot();
}
});

Expand All @@ -52,7 +53,8 @@ describe('integration tests for generated files under different template paramet
];
for (const index in expectedFiles) {
const file = await readFile(path.join(outputDir, expectedFiles[index]), 'utf8');
expect(file).toMatchSnapshot();
const fileWithAnyDate = file.replace(/date="\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z)"/, 'date="AnyDate"');
expect(fileWithAnyDate).toMatchSnapshot();
}
for (const index in notExpectedFiles) {
expect(existsSync(path.join(outputDir, notExpectedFiles[index]))).toBeFalsy();
Expand All @@ -77,7 +79,8 @@ describe('integration tests for generated files under different template paramet
];
for (const index in expectedFiles) {
const file = await readFile(path.join(outputDir, expectedFiles[index]), 'utf8');
expect(file).toMatchSnapshot();
const fileWithAnyDate = file.replace(/date="\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z)"/, 'date="AnyDate"');
expect(fileWithAnyDate).toMatchSnapshot();
}
for (const index in notExpectedFiles) {
expect(existsSync(path.join(outputDir, notExpectedFiles[index]))).toBeFalsy();
Expand Down

0 comments on commit e0bf8bd

Please sign in to comment.