Skip to content

Commit cfbd918

Browse files
committed
test: fix
1 parent 17747b9 commit cfbd918

File tree

1 file changed

+38
-4
lines changed

1 file changed

+38
-4
lines changed

test/tempoid_test.dart

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,18 @@ import 'package:tempoid/tempoid.dart';
66
void main() {
77
test('Should return an id', () {
88
final random = FakeRandom();
9-
expect(TempoId.generate(randomLength: 1, time: 0, random: random), '00');
10-
expect(TempoId.generate(randomLength: 1, time: 0, random: random), '01');
11-
expect(TempoId.generate(randomLength: 1, time: 5, random: random), '52');
9+
expect(
10+
TempoId.generate(randomLength: 1, time: 0, random: random),
11+
'000000000',
12+
);
13+
expect(
14+
TempoId.generate(randomLength: 1, time: 0, random: random),
15+
'000000001',
16+
);
17+
expect(
18+
TempoId.generate(randomLength: 1, time: 5, random: random),
19+
'000000052',
20+
);
1221
});
1322

1423
test('Should handle time overflow', () {
@@ -32,7 +41,7 @@ void main() {
3241
alphabet: Alphabet.numbers,
3342
random: random,
3443
),
35-
'01',
44+
'001',
3645
);
3746
});
3847

@@ -87,6 +96,31 @@ void main() {
8796
);
8897
});
8998

99+
test('Should generate without time', () {
100+
final random = FakeRandom();
101+
expect(
102+
TempoId.generate(
103+
timeLength: 0,
104+
randomLength: 1,
105+
time: 1234,
106+
alphabet: Alphabet.numbers,
107+
random: random,
108+
),
109+
'0',
110+
);
111+
112+
expect(
113+
TempoId.generate(
114+
timeLength: 0,
115+
randomLength: 1,
116+
time: 1234,
117+
alphabet: Alphabet.numbers,
118+
random: random,
119+
),
120+
'1',
121+
);
122+
});
123+
90124
test('Should return inner string on toString', () {
91125
expect(const TempoId('abc').toString(), 'abc');
92126
});

0 commit comments

Comments
 (0)