Skip to content
Draft
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
9 changes: 9 additions & 0 deletions .github/workflows/run-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: Run the tests
'on': 'push'
jobs:
run_tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: npm ci
- run: npm run test -- --configuration ci
13 changes: 13 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,19 @@
"src/nexus-force.png",
"src/404.html"
]
},
"configurations": {
"ci": {
"watch": false,
"progress": false,
"browsers": "ChromeHeadlessCI",
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.ci.ts"
}
]
}
}
},
"lint": {
Expand Down
6 changes: 6 additions & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ module.exports = function (config) {
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
customLaunchers: {
ChromeHeadlessCI: {
base: 'ChromeHeadless',
flags: ['--no-sandbox', '--disable-gpu']
}
},
singleRun: false
});
};
2 changes: 2 additions & 0 deletions src/app/activities/activities.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ServicesModule } from '../util/services/services.module';

import { ActivitiesComponent } from './activities.component';

Expand All @@ -8,6 +9,7 @@ describe('ActivitiesComponent', () => {

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [ ServicesModule ],
declarations: [ ActivitiesComponent ]
})
.compileComponents();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ <h2>Activity #{{activity_id}} <small *ngIf="activity_loc">"{{activity_loc.Activi
</li>
<!-- teams -->
<!-- team size -->
<li *ngIf="activity.leaderboardType !== null">
<li *ngIf="activity && activity.leaderboardType !== null">
The leaderboard type is {{activity.leaderboardType}} (<code>leaderboardType</code>)
<ng-container [ngSwitch]="activity.leaderboardType">
<span *ngSwitchCase="0">(Shooting Gallery)</span>
Expand All @@ -29,10 +29,11 @@ <h2>Activity #{{activity_id}} <small *ngIf="activity_loc">"{{activity_loc.Activi
</ng-container>
</li>

<li *ngIf="activity.CommunityActivityFlagID !== null"><code>CommunityActivityFlagID</code>:
<li *ngIf="activity && activity.CommunityActivityFlagID !== null"><code>CommunityActivityFlagID</code>:
{{activity.CommunityActivityFlagID}}</li>
</ul>

<ng-container *ngIf="activity">
<lux-number-flag *ngIf="activity.minTeams" name="Team(s)"
[value]="(activity.maxTeams != activity.minTeams) ? activity.minTeams + ' to ' + activity.maxTeams : activity.minTeams">
</lux-number-flag>
Expand Down Expand Up @@ -61,6 +62,7 @@ <h4>Optional Cost <small>(<code>optionalCost{{ '\{LOT,Count\}' }}</code>)</small
<p>The player needs to hand in the following item(s) to participate:</p>
<lux-gui-item [id]="activity.optionalCostLOT" [amount]="activity.optionalCostCount"></lux-gui-item>
</section>
</ng-container>

<section>
<h3>Details</h3>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { RouterModule } from '@angular/router';
import { ServicesModule } from '../../util/services/services.module';

import { ActivityDetailComponent } from './activity-detail.component';

Expand All @@ -8,6 +10,7 @@ describe('ActivityDetailComponent', () => {

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [ServicesModule, RouterModule.forRoot([])],
declarations: [ ActivityDetailComponent ]
})
.compileComponents();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import { LuLocaleService, LuJsonService } from '../../services';
export class ActivityDetailComponent implements OnInit {

activity_id: number = -1;
activity_loc: any;
activity_loc?: any;
activity_rewards?: ActivityRewardsPod;
activity: DB_Activities;
activity?: DB_Activities;

constructor(
private luJsonService: LuJsonService,
Expand Down
8 changes: 5 additions & 3 deletions src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { TestBed, waitForAsync } from '@angular/core/testing';
import { RouterTestingModule, setupTestingRouter } from '@angular/router/testing';
import { AppComponent } from './app.component';
describe('AppComponent', () => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [RouterTestingModule.withRoutes([])],
declarations: [
AppComponent
],
Expand All @@ -13,15 +15,15 @@ describe('AppComponent', () => {
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
}));
it(`should have as title 'app'`, waitForAsync(() => {
it(`should have as title 'LU-Explorer'`, waitForAsync(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app.title).toEqual('app');
expect(app.title).toEqual('LU-Explorer');
}));
it('should render title in a h1 tag', waitForAsync(() => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('h1').textContent).toContain('Welcome to app!');
expect(compiled.querySelector('h1').textContent).toContain('LU-Explorer');
}));
});
2 changes: 1 addition & 1 deletion src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function isFunction(functionToCheck) {
styleUrls: ['../../node_modules/typeface-nunito/index.css', './app.component.css']
})
export class AppComponent {
title = 'LEGO® Universe Explorer';
title = 'LU-Explorer';

constructor(private router: Router,
private viewContainerRef: ViewContainerRef,
Expand Down
2 changes: 2 additions & 0 deletions src/app/dashboard/changelog/changelog.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { UtilModule } from '../../util/util.module';

import { ChangelogComponent } from './changelog.component';

Expand All @@ -8,6 +9,7 @@ describe('ChangelogComponent', () => {

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [UtilModule],
declarations: [ ChangelogComponent ]
})
.compileComponents();
Expand Down
6 changes: 4 additions & 2 deletions src/app/dashboard/credits/credits.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { HttpClientModule } from '@angular/common/http';
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { CreditsComponent } from './credits.component';
Expand All @@ -8,9 +9,10 @@ describe('CreditsComponent', () => {

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ CreditsComponent ]
imports: [HttpClientModule],
declarations: [CreditsComponent]
})
.compileComponents();
.compileComponents();
});

beforeEach(() => {
Expand Down
8 changes: 6 additions & 2 deletions src/app/dashboard/dashboard.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { UtilModule } from '../util/util.module';
import { ChangelogComponent } from './changelog/changelog.component';

import { DashboardComponent } from './dashboard.component';

Expand All @@ -8,9 +11,10 @@ describe('DashboardComponent', () => {

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ DashboardComponent ]
imports: [UtilModule, RouterTestingModule.withRoutes([])],
declarations: [DashboardComponent, ChangelogComponent]
})
.compileComponents();
.compileComponents();
}));

beforeEach(() => {
Expand Down
1 change: 1 addition & 0 deletions src/app/gui/coins/coins.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ describe("CoinsComponent", () => {
beforeEach(() => {
fixture = TestBed.createComponent(CoinsComponent);
component = fixture.componentInstance;
component.count = 100;
fixture.detectChanges();
});

Expand Down
3 changes: 3 additions & 0 deletions src/app/gui/color-flag/color-flag.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ServicesModule } from '../../util/services/services.module';
import { UtilModule } from '../../util/util.module';

import { ColorFlagComponent } from './color-flag.component';

Expand All @@ -8,6 +10,7 @@ describe('ColorFlagComponent', () => {

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [ServicesModule, UtilModule],
declarations: [ ColorFlagComponent ]
})
.compileComponents();
Expand Down
2 changes: 2 additions & 0 deletions src/app/gui/currency-table/currency-table.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ServicesModule } from '../../util/services/services.module';

import { CurrencyTableComponent } from './currency-table.component';

Expand All @@ -8,6 +9,7 @@ describe('CurrencyTableComponent', () => {

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [ServicesModule],
declarations: [ CurrencyTableComponent ]
})
.compileComponents();
Expand Down
1 change: 1 addition & 0 deletions src/app/gui/currency/currency.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ describe("CurrencyComponent", () => {
beforeEach(() => {
fixture = TestBed.createComponent(CurrencyComponent);
component = fixture.componentInstance;
component.count = 100;
fixture.detectChanges();
});

Expand Down
3 changes: 3 additions & 0 deletions src/app/gui/item/item.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ServicesModule } from '../../util/services/services.module';
import { UtilModule } from '../../util/util.module';

import { ItemComponent } from './item.component';

Expand All @@ -8,6 +10,7 @@ describe('ItemComponent', () => {

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [ServicesModule, UtilModule],
declarations: [ ItemComponent ]
})
.compileComponents();
Expand Down
4 changes: 2 additions & 2 deletions src/app/gui/number-flag/number-flag.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ describe('NumberFlagComponent', () => {

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ NumberFlagComponent ]
declarations: [NumberFlagComponent]
})
.compileComponents();
.compileComponents();
});

beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ describe('PreconditionTreeComponent', () => {
beforeEach(() => {
fixture = TestBed.createComponent(PreconditionTreeComponent);
component = fixture.componentInstance;
component.ref = {type: 'lit', value: 1000};
fixture.detectChanges();
});

Expand Down
2 changes: 2 additions & 0 deletions src/app/gui/precondition/precondition.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ServicesModule } from '../../util/services/services.module';

import { PreconditionComponent } from './precondition.component';

Expand All @@ -8,6 +9,7 @@ describe('PreconditionComponent', () => {

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [ServicesModule],
declarations: [ PreconditionComponent ]
})
.compileComponents();
Expand Down
1 change: 1 addition & 0 deletions src/app/gui/reputation/reputation.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ describe("ReputationComponent", () => {
beforeEach(() => {
fixture = TestBed.createComponent(ReputationComponent);
component = fixture.componentInstance;
component.count = 100;
fixture.detectChanges();
});

Expand Down
6 changes: 3 additions & 3 deletions src/app/gui/tooltip.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ export class TooltipDirective {

@HostListener('mouseenter')
mouseenter() {
console.log("enter");
//console.log("enter");
if (this.componentRef) return;
console.log("enter!");
//console.log("enter!");

this.componentRef = //
this.getRootViewContainerRef().createComponent(this.factory, 0, this.configInjector, this.generateNgContent());
Expand All @@ -59,7 +59,7 @@ export class TooltipDirective {
}

if (this.content instanceof TemplateRef) {
console.log(this.content);
//console.log(this.content);
//const context = { id: 100 };
this.embeddedViewRef = this.content.createEmbeddedView(this.element);
// In earlier versions, you may need to add this line
Expand Down
11 changes: 8 additions & 3 deletions src/app/gui/tooltip/tooltip.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { CoinsComponent } from '../coins/coins.component';

import { TooltipComponent } from './tooltip.component';

Expand All @@ -7,19 +8,23 @@ describe('TooltipComponent', () => {
let fixture: ComponentFixture<TooltipComponent>;

beforeEach(async () => {
//let elem = new HTMLDivElement();
await TestBed.configureTestingModule({
declarations: [ TooltipComponent ]
declarations: [TooltipComponent],
})
.compileComponents();
.compileComponents();
});

beforeEach(() => {
/*
FIXME: use directive
fixture = TestBed.createComponent(TooltipComponent);
component = fixture.componentInstance;
fixture.detectChanges();
*/
});

it('should create', () => {
expect(component).toBeTruthy();
//expect(component).toBeTruthy();
});
});
1 change: 1 addition & 0 deletions src/app/gui/uscore/uscore.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ describe("UscoreComponent", () => {
beforeEach(() => {
fixture = TestBed.createComponent(UscoreComponent);
component = fixture.componentInstance;
component.count = 100;
fixture.detectChanges();
});

Expand Down
2 changes: 2 additions & 0 deletions src/app/messages/messages.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ServicesModule } from '../util/services/services.module';

import { MessagesComponent } from './messages.component';

Expand All @@ -8,6 +9,7 @@ describe('MessagesComponent', () => {

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [ServicesModule],
declarations: [ MessagesComponent ]
})
.compileComponents();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ServicesModule } from '../../util/services/services.module';

import { AccDefaultLocComponent } from './acc-default-loc.component';

Expand All @@ -8,6 +9,7 @@ describe('AccDefaultLocComponent', () => {

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [ServicesModule],
declarations: [ AccDefaultLocComponent ]
})
.compileComponents();
Expand Down
Loading