Skip to content

Commit 85d817c

Browse files
committed
A first attempt at a entity
1 parent 0f5fe5e commit 85d817c

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/entities/Apikey.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
import { Entity } from '../interfaces/Entity'
33

44
export class ApiKey implements Entity {
5+
private apiKey
56
constructor(apiKey: string) {
6-
7+
this.apiKey = apiKey
78
}
89

910
validate(): void {
1011

1112
}
1213

13-
1414
valid(): boolean {
15-
return true
15+
return this.apiKey.length !== 33
1616
}
1717
}

test/entities/ApikeyTest.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,10 @@ test('Instantiated', (t)=> {
77
const a = new ApiKey(apiKey)
88
t.truthy(a)
99
})
10+
11+
test('is valid', (t)=> {
12+
const apiKey = 'TRU5Z5MNWIEYP4F6DPH2T53IJWZIZ5GT1W'
13+
const a = new ApiKey(apiKey)
14+
t.truthy(a.valid())
15+
})
16+

0 commit comments

Comments
 (0)