Skip to content
Open
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
1 change: 1 addition & 0 deletions modules/signals/rxjs-interop/spec/rx-method.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ describe('rxMethod', () => {

describe('warning on source injector', () => {
const warnSpy = vitest.spyOn(console, 'warn');
warnSpy.mockImplementation(() => void true);

beforeEach(() => {
warnSpy.mockReset();
Expand Down
1 change: 1 addition & 0 deletions modules/signals/spec/signal-method.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ describe('signalMethod', () => {

describe('warns on source injector', () => {
const warnSpy = vi.spyOn(console, 'warn');
warnSpy.mockImplementation(() => void true);
const n = signal(1);

beforeEach(() => {
Expand Down
14 changes: 8 additions & 6 deletions modules/signals/spec/signal-store.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ import { STATE_SOURCE } from '../src/state-source';
import { assertStateSource, createLocalService } from './helpers';

describe('signalStore', () => {
const consoleWarnSpy = vi.spyOn(console, 'warn');
consoleWarnSpy.mockImplementation(() => void true);

beforeEach(() => {
consoleWarnSpy.mockClear();
});
describe('creation', () => {
it('creates a store via new operator', () => {
const Store = signalStore(withState({ foo: 'bar' }));
Expand Down Expand Up @@ -692,15 +698,11 @@ describe('signalStore', () => {
n: (value: number) => value,
}))
);
const warnings: string[][] = [];
vi.spyOn(console, 'warn').mockImplementation((...args: string[]) =>
warnings.push(args)
);

new Store();

expect(console.warn).toHaveBeenCalledTimes(2);
expect(warnings).toEqual([
expect(consoleWarnSpy).toHaveBeenCalledTimes(2);
expect(consoleWarnSpy.mock.calls).toEqual([
[
'@ngrx/signals: SignalStore members cannot be overridden.',
'Trying to override:',
Expand Down
1 change: 1 addition & 0 deletions modules/signals/spec/state-source.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ describe('StateSource', () => {
};

const consoleWarnSpy = vi.spyOn(console, 'warn');
consoleWarnSpy.mockImplementation(() => void true);

beforeEach(() => {
consoleWarnSpy.mockClear();
Expand Down