🎨 style(new!): add new ui vue.js

Signed-off-by: Abhiraj Roy <157954129+iconized@users.noreply.github.com>
This commit is contained in:
Abhiraj Roy
2024-06-05 04:26:16 +05:30
parent 4878325171
commit 5f4ddc3090
110 changed files with 9442 additions and 0 deletions

39
test/github.test.js Normal file
View File

@@ -0,0 +1,39 @@
import { beforeEach, describe, expect, it } from 'vitest'
import { getGistById } from '../utils/github-api.js'
describe('Testing Github Gists API', () => {
const gistId1 = '799fe15f4b75706242b10d978e935067';
// do this before each test
beforeEach(() => {
})
it('Response status is successfull: 200', async () => {
const getGithubGist = async (gistId) => await fetch('https://api.github.com/gists/' + gistId)
const response = await getGithubGist(gistId1)
expect(response.status).toBe(200)
})
/**
* Check if the response is a JSON
*/
it('The response is a JSON', async () => {
const gist = await getGistById(gistId1)
function isJson(str) {
try {
JSON.parse(str);
} catch (e) {
return true;
}
return false;
}
expect(isJson(gist)).toBe(true)
})
})