Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Account for all files, not just the first 100. #227

Merged
merged 2 commits into from
Jun 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
174 changes: 75 additions & 99 deletions actions/status-checker/__tests__/pull-updater.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,48 +227,40 @@ ${PREVIEW_TABLE_END}`;
});

it("getModifiedMarkdownFiles gets only modified files", () => {
const { files, exceedsMax } = getModifiedMarkdownFiles({
body: "",
changedFiles: 3,
checksUrl: "https://github.com/dotnet/docs/pull/1/checks",
state: "OPEN",
files: {
edges: [
{
node: {
deletions: 1,
additions: 1,
changeType: "RENAMED",
path: "path/to/renamed-file.md",
},
},
{
node: {
deletions: 1,
additions: 0,
changeType: "DELETED",
path: "path/to/deleted-file.md",
},
},
{
node: {
deletions: 5,
additions: 17,
changeType: "MODIFIED",
path: "path/to/modified-file.md",
},
},
{
node: {
deletions: 0,
additions: 1,
changeType: "MODIFIED",
path: "includes/modified-file.md",
},
},
],
const { files, exceedsMax } = getModifiedMarkdownFiles([
{
node: {
deletions: 1,
additions: 1,
changeType: "RENAMED",
path: "path/to/renamed-file.md",
},
},
{
node: {
deletions: 1,
additions: 0,
changeType: "DELETED",
path: "path/to/deleted-file.md",
},
},
});
{
node: {
deletions: 5,
additions: 17,
changeType: "MODIFIED",
path: "path/to/modified-file.md",
},
},
{
node: {
deletions: 0,
additions: 1,
changeType: "MODIFIED",
path: "includes/modified-file.md",
},
},
]);

expect(exceedsMax).toBe(false);
expect(files).toEqual([
Expand All @@ -288,71 +280,55 @@ ${PREVIEW_TABLE_END}`;
});

it("isPullRequestModifyingMarkdownFiles returns false when no modified .md files", () => {
const actual = isPullRequestModifyingMarkdownFiles({
body: "",
checksUrl: "https://github.com/dotnet/docs/pull/1/checks",
state: "OPEN",
changedFiles: 2,
files: {
edges: [
{
node: {
deletions: 1,
additions: 1,
changeType: "COPIED",
path: "path/to/renamed-file.md",
},
},
{
node: {
deletions: 1,
additions: 0,
changeType: "DELETED",
path: "path/to/deleted-file.md",
},
},
],
const actual = isPullRequestModifyingMarkdownFiles([
{
node: {
deletions: 1,
additions: 1,
changeType: "COPIED",
path: "path/to/renamed-file.md",
},
},
{
node: {
deletions: 1,
additions: 0,
changeType: "DELETED",
path: "path/to/deleted-file.md",
},
},
});
]);

expect(actual).toBeFalsy();
});

it("isPullRequestModifyingMarkdownFiles returns true when modified .md files", () => {
const actual = isPullRequestModifyingMarkdownFiles({
body: "",
checksUrl: "https://github.com/dotnet/docs/pull/1/checks",
state: "OPEN",
changedFiles: 3,
files: {
edges: [
{
node: {
deletions: 1,
additions: 1,
changeType: "RENAMED",
path: "path/to/renamed-file.md",
},
},
{
node: {
deletions: 1,
additions: 0,
changeType: "DELETED",
path: "path/to/deleted-file.md",
},
},
{
node: {
deletions: 0,
additions: 1,
changeType: "MODIFIED",
path: "path/to/modified-file.md",
},
},
],
const actual = isPullRequestModifyingMarkdownFiles([
{
node: {
deletions: 1,
additions: 1,
changeType: "RENAMED",
path: "path/to/renamed-file.md",
},
},
});
{
node: {
deletions: 1,
additions: 0,
changeType: "DELETED",
path: "path/to/deleted-file.md",
},
},
{
node: {
deletions: 0,
additions: 1,
changeType: "MODIFIED",
path: "path/to/modified-file.md",
},
},
]);

expect(actual).toBeTruthy();
});
Expand Down
75 changes: 46 additions & 29 deletions actions/status-checker/dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion actions/status-checker/dist/index.js.map

Large diffs are not rendered by default.

Loading
Loading