@bbki.ng/site 5.4.10 → 5.4.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # @bbki.ng/site
2
2
 
3
+ ## 5.4.11
4
+
3
5
  ## 5.4.10
4
6
 
5
7
  ## 5.4.9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbki.ng/site",
3
- "version": "5.4.10",
3
+ "version": "5.4.11",
4
4
  "description": "code behind bbki.ng",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1,53 +1,19 @@
1
1
  import {
2
- addOssWebpProcessStyle,
3
- calcDefaultImgSize,
4
2
  delay,
5
3
  floatNumberToPercentageString,
6
4
  getEnv,
7
5
  minDelay,
8
6
  } from "@/utils";
9
- import { ossProcessType } from "@/types/oss";
10
- import { OSS_PHOTOS } from "@/constants/photos";
11
7
 
12
8
  jest.useFakeTimers();
13
9
  jest.spyOn(window, "setTimeout");
14
10
 
15
- describe("calcDefaultImgSize", () => {
16
- it("should respect default width", () => {
17
- const dw = 500;
18
- expect(calcDefaultImgSize(OSS_PHOTOS.shopping, dw).width).toEqual(dw);
19
- });
20
- it("should return 576 as default width when photo is horizontal", () => {
21
- expect(calcDefaultImgSize(OSS_PHOTOS.stone).width).toEqual(576);
22
- });
23
- it("should return 384 as default width when photo is horizontal", () => {
24
- expect(calcDefaultImgSize(OSS_PHOTOS.player).width).toEqual(384);
25
- });
26
- });
27
-
28
11
  describe("floatNumberToPercentageString", () => {
29
12
  it("should return percentage string correctly", () => {
30
13
  expect(floatNumberToPercentageString(0.8)).toBe("80%");
31
14
  });
32
15
  });
33
16
 
34
- describe("addOssWebpProcessStyle", () => {
35
- it("should return original url when image's url is invalid", () => {
36
- const originalUrl = "foo";
37
- expect(addOssWebpProcessStyle(originalUrl, ossProcessType.WEBP)).toEqual(
38
- originalUrl
39
- );
40
- });
41
-
42
- it("should add oss style to url correctly", () => {
43
- const originalUrl =
44
- "https://zjh-im-res.oss-cn-shenzhen.aliyuncs.com/image/xiang-jiang-river/DSCF2203-1.jpg";
45
- expect(addOssWebpProcessStyle(originalUrl, ossProcessType.WEBP)).toEqual(
46
- `${originalUrl}?x-oss-process=style/${ossProcessType.WEBP}`
47
- );
48
- });
49
- });
50
-
51
17
  describe("delay", () => {
52
18
  it("should delay correctly", () => {
53
19
  delay(5000);