Skip to content

Commit

Permalink
chore: fix transfer tests
Browse files Browse the repository at this point in the history
Co-authored-by: Valerio Como <[email protected]>
  • Loading branch information
astagi and valeriocomo authored Dec 10, 2024
1 parent b8d5459 commit 8f30a0e
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"mounts": [
"source=design-angular-kit-bundle-node_modules,target=${containerWorkspaceFolder}/node_modules,type=volume" // deps volume
],
"remoteUser": "root",
// "remoteUser": "root",
"postCreateCommand": "sh .devcontainer/scripts/postCreateCommand.sh",
// "postStartCommand": "/bin/bash -c '.devcontainer/scripts/postStartCommand.sh \"${containerWorkspaceFolder}\"'",
"postStartCommand": "sh .devcontainer/scripts/postStartCommand.sh \"${containerWorkspaceFolder}\"",
Expand Down
6 changes: 3 additions & 3 deletions .devcontainer/scripts/postCreateCommand.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#/bin/bash
echo "lifecycle hook: postCreateCommand => start"

# echo "Set node_modules permission"
# sudo chown -R node:node node_modules
# echo "Set node_modules permission: done"
echo "Set node_modules permission"
sudo chown -R node:node node_modules
echo "Set node_modules permission: done"

echo "Installing deps"
npm i
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { HostAttributeToken } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { tb_base } from 'projects/design-angular-kit/src/test';
import { TransferStore } from '../store/transfer.store';
import { ItTransferListComponent } from './transfer-list.component';

Expand All @@ -10,11 +10,13 @@ describe('ItTransferListComponent', <T>() => {
let fixture: ComponentFixture<ItTransferListComponent<T>>;

beforeEach(async () => {
const { imports, providers } = tb_base;

await TestBed.configureTestingModule({
imports: [ItTransferListComponent],
imports,
providers: [
...providers,
TransferStore,
TranslateService,
{ provide: new HostAttributeToken('title'), useValue: 'title' },
{ provide: new HostAttributeToken('sourceType'), useValue: 'source' },
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { combineLatest, distinctUntilChanged, map, shareReplay, skip, startWith,
import { ItAbstractComponent } from '../../../../abstracts/abstract.component';
import { TransferStore } from '../store/transfer.store';
import { TranslateModule } from '@ngx-translate/core';
import { ItIconComponent } from 'projects/design-angular-kit/src/public_api';
import { SourceType, TransferItem } from '../transfer.model';

interface SelectableTransferItem<T> extends TransferItem<T> {
Expand All @@ -15,7 +14,7 @@ interface SelectableTransferItem<T> extends TransferItem<T> {
@Component({
selector: 'it-transfer-list',
standalone: true,
imports: [ItIconComponent, TranslateModule, AsyncPipe, TitleCasePipe],
imports: [TranslateModule, AsyncPipe, TitleCasePipe],
templateUrl: './transfer-list.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { TranslateFakeLoader, TranslateLoader, TranslateModule, TranslateService } from '@ngx-translate/core';
import { tb_base } from 'projects/design-angular-kit/src/test';
import { TransferStore } from './store/transfer.store';
import { ItTransferComponent } from './transfer.component';

Expand All @@ -9,18 +9,11 @@ describe('ItTransferComponent', () => {
let fixture: ComponentFixture<ItTransferComponent>;

beforeEach(async () => {
const { imports, providers } = tb_base;

await TestBed.configureTestingModule({
imports: [
ItTransferComponent,
//https://stackoverflow.com/a/52461467/2642723
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useClass: TranslateFakeLoader,
},
}),
],
providers: [TransferStore, TranslateService],
imports,
providers: [...providers, TransferStore],
}).compileComponents();

fixture = TestBed.createComponent(ItTransferComponent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { ItIconComponent } from 'projects/design-angular-kit/src/public_api';
selector: 'it-transfer',
standalone: true,
templateUrl: './transfer.component.html',
imports: [ItIconComponent, TranslateModule, ItTransferListComponent, NgClass, AsyncPipe, ReactiveFormsModule],
imports: [TranslateModule, ItIconComponent, ItTransferListComponent, NgClass, AsyncPipe, ReactiveFormsModule],
providers: [TransferStore],
changeDetection: ChangeDetectionStrategy.OnPush,
})
Expand Down

0 comments on commit 8f30a0e

Please sign in to comment.