This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { PureComponent } from 'react' | |
import { | |
View, | |
Text, | |
VirtualizedList | |
} from 'react-native' | |
class DataSource { | |
getElementAtIndex (index) { | |
return { key: index } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const loginServiceSpy = jasmine.createSpyObj('LoginService', ['login']); | |
describe('Login Component Isolated Test', () => { | |
let component: LoginComponent; | |
beforeEach(async(() => { | |
component = new LoginComponent(routerSpy, new FormBuilder(), loginServiceSpy); | |
})); | |
function updateForm(userEmail, userPassword) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const loginServiceSpy = jasmine.createSpyObj('LoginService', ['login']); | |
describe('Login Component Shallow Test', () => { | |
let fixture: ComponentFixture<LoginComponent>; | |
function updateForm(userEmail, userPassword) { | |
fixture.componentInstance.loginForm.controls['username'].setValue(userEmail); | |
fixture.componentInstance.loginForm.controls['password'].setValue(userPassword); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const loginServiceSpy = jasmine.createSpyObj('LoginService', ['login']); | |
const testUserData = { id: 1, name: 'TekLoon'}; | |
describe('Login Component Integrated Test', () => { | |
let fixture: ComponentFixture<LoginComponent>; | |
let loginSpy; | |
function updateForm(userEmail, userPassword) { | |
fixture.componentInstance.loginForm.controls['username'].setValue(userEmail); | |
fixture.componentInstance.loginForm.controls['password'].setValue(userPassword); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is timer producer | |
const INTERVAL_DURATION = 60000; | |
const url = process.env.CLOUDAMQP_URL || "amqp://localhost"; | |
const amqp = require('amqplib'); | |
exports.startTimer = () => { | |
amqp.connect(url).then((connection) => { | |
connection.createChannel().then((channel) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const url = process.env.CLOUDAMQP_URL || "amqp://localhost"; | |
const amqp = require('amqplib'); | |
const { scrapQuoteOfTheDay } = require('../controllers/quoteController'); | |
exports.start = () => { | |
amqp.connect(url).then((connection) => { | |
connection.createChannel().then((channel) => { | |
const exchange = 'quote'; | |
channel.assertExchange(exchange, 'direct', {durable: false}); | |
channel.assertQueue('', { exclusive: true }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const rp = require('request-promise'); | |
const $ = require('cheerio'); | |
const fs = require('fs'); | |
const path = require('path'); | |
const quotesFilePath = path.join(process.cwd(), 'public', 'quotes.json'); | |
const url = 'http://wisdomquotes.com/stoic-quotes/'; | |
exports.scrapQuoteOfTheDay = () => { | |
let qotdUrl = 'http://wisdomquotes.com/?time=' + (Date.now()); | |
rp(qotdUrl).then((html) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
h1 Quote of The Day | |
h3 List of Quotes that we crawled | |
p Refresh every minute and you will saw a new quote | |
ul | |
- for (var x = 0; x < quotes.length; x++) | |
li #{quotes[x]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Import env file | |
require('dotenv').config(); | |
const express = require('express'); | |
const path = require('path'); | |
const fs = require('fs'); | |
const app = express(); | |
const { keepAwake } = require('./src/util/heroku_util'); | |
const { scrapQuoteOfTheDay } = require('./src/controllers/quoteController'); | |
const { start } = require('./src/consumers/scrapQuoteConsumer'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
h1 Quote of The Day | |
h3 List of Quotes that we crawled | |
p Refresh every minute and you will saw a new quote | |
ul#quoteList | |
script. | |
let quotes = []; | |
var eventSource = new EventSource('quoteEvent'); | |
// Listen to New Quote Event | |
eventSource.addEventListener('newQuote', function (e) { |
OlderNewer