-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7ecab38
commit 11d9899
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { TestBed } from '@angular/core/testing'; | ||
import { CartService } from './cart.service'; | ||
import { ToastrModule, ToastrService } from 'ngx-toastr'; | ||
import { HttpClientModule } from '@angular/common/http'; | ||
|
||
describe('CartService', () => { | ||
let service: CartService; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [ | ||
ToastrModule.forRoot(), | ||
HttpClientModule | ||
], | ||
providers: [ | ||
CartService, | ||
] | ||
}); | ||
service = TestBed.inject(CartService); | ||
}); | ||
|
||
it('should be created', () => { | ||
expect(service).toBeTruthy(); | ||
}); | ||
|
||
it('#should format a value to the ch-CH price format', () => { | ||
const result = service.formatPrice(594); | ||
expect(result).toBe('Fr. 594.–'); | ||
}); | ||
|
||
it('#should return a placeholder for instock icon color', () => { | ||
const result = service.inStock(10); | ||
expect(result).toBe('bi-check-circle-fill stockgreen'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* To learn more about this file see: https://angular.io/config/tsconfig. */ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "./out-tsc/spec", | ||
"types": [ | ||
"jasmine" | ||
] | ||
}, | ||
"include": [ | ||
"src/**/*.spec.ts", | ||
"src/**/*.d.ts" | ||
] | ||
} |