Skip to content

Commit b74b1a4

Browse files
Merge pull request #20 from toybz/ci-cd
Inline Script Test
2 parents 85e4396 + 91e9e10 commit b74b1a4

File tree

4 files changed

+50
-7
lines changed

4 files changed

+50
-7
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,5 @@ Thumbs.db
4545
todo.md
4646
developmentInfos.md
4747
Archive.zip
48+
/.lh
49+
/.vscode

.nycrc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"coverage": "test",
3+
"check-coverage": true,
4+
"functions": 50,
5+
"lines": 50,
6+
"report-dir": "./coverage",
7+
"reporter": [
8+
"lcov"
9+
]
10+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { FlutterwaveModule } from "./flutterwave.module";
2+
import { TestBed } from "@angular/core/testing";
3+
4+
describe("FlutterwaveModule", () => {
5+
beforeEach(async () => {
6+
await TestBed.configureTestingModule({
7+
imports: [FlutterwaveModule],
8+
providers: [],
9+
}).compileComponents();
10+
});
11+
12+
it("should create", () => {
13+
const myModule = TestBed.get(FlutterwaveModule);
14+
expect(myModule).toBeTruthy();
15+
});
16+
17+
it("should load Flutterwave Inline script and have FlutterwaveCheckout function", (done) => {
18+
const script = document.createElement("script");
19+
script.src = "https://checkout.flutterwave.com/v3.js";
20+
script.onload = () => {
21+
//@ts-ignore
22+
//expect(FlutterwaveCheckout).toBeDefined();
23+
expect(
24+
document.querySelector(`script[src="${script.src}"]`)
25+
).not.toBeNull();
26+
done();
27+
};
28+
document.body.appendChild(script);
29+
});
30+
});
Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2+
import { FlutterwaveModule } from "../flutterwave.module";
23

3-
import { MakePaymentComponent } from './make-payment.component';
4+
import { MakePaymentComponent } from "./make-payment.component";
45

5-
describe('MakePaymentComponent', () => {
6+
describe("MakePaymentComponent", () => {
67
let component: MakePaymentComponent;
78
let fixture: ComponentFixture<MakePaymentComponent>;
89

910
beforeEach(async(() => {
1011
TestBed.configureTestingModule({
11-
declarations: [ MakePaymentComponent ]
12-
})
13-
.compileComponents();
12+
imports: [FlutterwaveModule],
13+
// declarations: [MakePaymentComponent],
14+
}).compileComponents();
1415
}));
1516

1617
beforeEach(() => {
@@ -19,7 +20,7 @@ describe('MakePaymentComponent', () => {
1920
fixture.detectChanges();
2021
});
2122

22-
it('should be created', () => {
23+
it("should be created", () => {
2324
expect(component).toBeTruthy();
2425
});
25-
});
26+
});

0 commit comments

Comments
 (0)