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

refactor(DebugInfo): Changes DebugInfo constructor signature to POJO #636

Merged
merged 3 commits into from
May 14, 2019
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
18 changes: 2 additions & 16 deletions addon-test-support/@ember/test-helpers/-internal/debug-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,22 +85,8 @@ export class TestDebugInfo implements DebugInfo {
private _debugInfo: MaybeDebugInfo;
private _summaryInfo: SummaryInfo | undefined = undefined;

constructor(
hasPendingTimers: boolean,
hasRunLoop: boolean,
hasPendingLegacyWaiters: boolean,
hasPendingTestWaiters: boolean,
hasPendingRequests: boolean,
debugInfo: MaybeDebugInfo = getDebugInfo()
) {
this._settledState = {
hasPendingTimers,
hasRunLoop,
hasPendingLegacyWaiters,
hasPendingTestWaiters,
hasPendingRequests,
};

constructor(settledState: SettledState, debugInfo: MaybeDebugInfo = getDebugInfo()) {
this._settledState = settledState;
this._debugInfo = debugInfo;
}

Expand Down
6 changes: 3 additions & 3 deletions addon-test-support/@ember/test-helpers/settled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,13 @@ export function getSettledState(): SettledState {
hasPendingRequests,
hasPendingTransitions: hasPendingTransitions(),
pendingRequestCount,
debugInfo: new TestDebugInfo(
debugInfo: new TestDebugInfo({
hasPendingTimers,
hasRunLoop,
hasPendingLegacyWaiters,
hasPendingTestWaiters,
hasPendingRequests
),
hasPendingRequests,
}),
};
}

Expand Down
104 changes: 91 additions & 13 deletions tests/unit/settled-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,13 @@ module('settled', function(hooks) {
hasPendingTransitions: null,
hasRunLoop: false,
pendingRequestCount: 0,
debugInfo: new TestDebugInfo(false, false, false, false, false),
debugInfo: new TestDebugInfo({
hasPendingTimers: false,
hasRunLoop: false,
hasPendingLegacyWaiters: false,
hasPendingTestWaiters: false,
hasPendingRequests: false,
}),
},
'post cond - getSettledState'
);
Expand Down Expand Up @@ -180,7 +186,13 @@ module('settled', function(hooks) {
hasPendingTransitions: null,
hasRunLoop: false,
pendingRequestCount: 0,
debugInfo: new TestDebugInfo(false, false, false, false, false),
debugInfo: new TestDebugInfo({
hasPendingTimers: false,
hasRunLoop: false,
hasPendingLegacyWaiters: false,
hasPendingTestWaiters: false,
hasPendingRequests: false,
}),
});
});

Expand All @@ -199,7 +211,13 @@ module('settled', function(hooks) {
hasPendingTransitions: null,
hasRunLoop: true,
pendingRequestCount: 0,
debugInfo: new TestDebugInfo(true, true, false, false, false),
debugInfo: new TestDebugInfo({
hasPendingTimers: true,
hasRunLoop: true,
hasPendingLegacyWaiters: false,
hasPendingTestWaiters: false,
hasPendingRequests: false,
}),
});
});

Expand All @@ -219,7 +237,13 @@ module('settled', function(hooks) {
hasPendingTransitions: null,
hasRunLoop: false,
pendingRequestCount: 0,
debugInfo: new TestDebugInfo(true, false, false, false, false),
debugInfo: new TestDebugInfo({
hasPendingTimers: true,
hasRunLoop: false,
hasPendingLegacyWaiters: false,
hasPendingTestWaiters: false,
hasPendingRequests: false,
}),
});
});

Expand All @@ -239,7 +263,13 @@ module('settled', function(hooks) {
hasPendingTransitions: null,
hasRunLoop: false,
pendingRequestCount: 0,
debugInfo: new TestDebugInfo(true, false, false, false, false),
debugInfo: new TestDebugInfo({
hasPendingTimers: true,
hasRunLoop: false,
hasPendingLegacyWaiters: false,
hasPendingTestWaiters: false,
hasPendingRequests: false,
}),
});
});

Expand All @@ -256,7 +286,13 @@ module('settled', function(hooks) {
hasPendingTransitions: null,
hasRunLoop: true,
pendingRequestCount: 0,
debugInfo: new TestDebugInfo(false, true, false, false, false),
debugInfo: new TestDebugInfo({
hasPendingTimers: false,
hasRunLoop: true,
hasPendingLegacyWaiters: false,
hasPendingTestWaiters: false,
hasPendingRequests: false,
}),
});
});

Expand Down Expand Up @@ -285,7 +321,13 @@ module('settled', function(hooks) {
hasPendingTransitions: null,
hasRunLoop: false,
pendingRequestCount: 1,
debugInfo: new TestDebugInfo(false, false, false, false, true),
debugInfo: new TestDebugInfo({
hasPendingTimers: false,
hasRunLoop: false,
hasPendingLegacyWaiters: false,
hasPendingTestWaiters: false,
hasPendingRequests: true,
}),
});
} else {
assert.deepEqual(getSettledState(), {
Expand All @@ -295,7 +337,13 @@ module('settled', function(hooks) {
hasPendingTransitions: null,
hasRunLoop: false,
pendingRequestCount: 0,
debugInfo: new TestDebugInfo(false, false, true, false, false),
debugInfo: new TestDebugInfo({
hasPendingTimers: false,
hasRunLoop: false,
hasPendingLegacyWaiters: true,
hasPendingTestWaiters: false,
hasPendingRequests: false,
}),
});
}
});
Expand All @@ -314,7 +362,13 @@ module('settled', function(hooks) {
hasPendingTransitions: null,
hasRunLoop: false,
pendingRequestCount: 0,
debugInfo: new TestDebugInfo(false, false, true, false, false),
debugInfo: new TestDebugInfo({
hasPendingTimers: false,
hasRunLoop: false,
hasPendingLegacyWaiters: true,
hasPendingTestWaiters: false,
hasPendingRequests: false,
}),
});

this.isWaiterPending = false;
Expand All @@ -338,7 +392,13 @@ module('settled', function(hooks) {
hasPendingTransitions: null,
hasRunLoop: false,
pendingRequestCount: 0,
debugInfo: new TestDebugInfo(false, false, false, true, false),
debugInfo: new TestDebugInfo({
hasPendingTimers: false,
hasRunLoop: false,
hasPendingLegacyWaiters: false,
hasPendingTestWaiters: true,
hasPendingRequests: false,
}),
});

this._testWaiter.endAsync(waiterItem);
Expand All @@ -360,7 +420,13 @@ module('settled', function(hooks) {
hasPendingTransitions: null,
hasRunLoop: false,
pendingRequestCount: 0,
debugInfo: new TestDebugInfo(false, false, true, false, false),
debugInfo: new TestDebugInfo({
hasPendingTimers: false,
hasRunLoop: false,
hasPendingLegacyWaiters: true,
hasPendingTestWaiters: false,
hasPendingRequests: false,
}),
});

run(() => {
Expand All @@ -371,7 +437,13 @@ module('settled', function(hooks) {
hasPendingTransitions: null,
hasRunLoop: true,
pendingRequestCount: 0,
debugInfo: new TestDebugInfo(false, true, true, false, false),
debugInfo: new TestDebugInfo({
hasPendingTimers: false,
hasRunLoop: true,
hasPendingLegacyWaiters: true,
hasPendingTestWaiters: false,
hasPendingRequests: false,
}),
});

next(this.confirmSettles(done));
Expand All @@ -383,7 +455,13 @@ module('settled', function(hooks) {
hasPendingTransitions: null,
hasRunLoop: true,
pendingRequestCount: 0,
debugInfo: new TestDebugInfo(true, true, true, false, false),
debugInfo: new TestDebugInfo({
hasPendingTimers: true,
hasRunLoop: true,
hasPendingLegacyWaiters: true,
hasPendingTestWaiters: false,
hasPendingRequests: false,
}),
});

this.isWaiterPending = false;
Expand Down
Loading